cocoapods intallation Errors in mac for flutter doctor - flutter

I install Homebrew.
Then I run command
"brew install cocoapods". It install successfully
but in flutter doctor i got error: cocoapods installed but not working properly. Error because of ruby incompatible version.
Tried another method
"sudo gem install cocoapods"
and got error:
While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0 directory.
This is m1 pro 2020 machine.

For MAC M1 chip Users try this solution
install ffi first (if not) In regular terminal using command: sudo arch -x86_64 gem install ffi then arch -x86_64 pod install --repo-update
Run flutter clean
Once complete, rebuild your Flutter application: flutter run

Try to avoid linking with system ruby and download a new ruby version using brew:
brew install ruby
Then add this line to .bash_profile or .zshrc
export PATH=/usr/local/opt/ruby/bin:$PATH
Close the terminal and open it again, then run this line to make sure the default ruby is the newly installed:
which ruby
Uninstall gem cocoapods and download it using brew
brew install cocoapods

Related

flutter Project is not working in simulator mac os

I installed the flutter and using android studio to run the flutter project on simulator. I clone the project from git and run it shows this error
Error: To set up CocoaPods for ARM macOS, run:
arch -x86_64 sudo gem install ffi
Error running pod install
Error launching application on iPhone 14 Pro Max.
but when I make the new basic project it runs fine but not the cloned project. I tried some stuff.
open ~/.profile and add these
exports export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
Also uninstall cocoapods and reinstall again. but nothing works for me.
what i am missing here?
Spending few hours on this problem finally it works for me.
Step 1: Uninstall the cocoapods by running this command in your project folder terminal
sudo gem uninstall cocoapods
Step 2: Install the cocoapods by running this command
brew install cocoapods
Note: Not forget to restart the android studio otherwise it would show another error. just close your project, close android studio, rerun the project or simulator.
Hope it will help someone.

Installing Flutter using Homebrew

I would like to install Flutter on my Apple M1 machine using Homebrew. But I am a bit hesitant because I am not sure if this will provide any benefits or it will create more trouble (e.g. permission issues). An alternative way would to be install Flutter using its installer from its docs.
My question is, is there a recommended way to install Flutter on an Apple M1 macbook? I could not find any docs regarding installing Flutter using Homebrew.
I ended up installing Flutter in with the following steps:
Install Homebrew (if you dont already have)* - install Homebrew
Install fvm using Homebrew - install fvm
Install your wanted flutter version through fvm - fvm documentation
Not necessary: Install Sidekick which basically gives you a visualization of your installed versions and flutter projects - install sidekick
Example of using fvm: fvm install {version} - # Installs specific version
#ilpianoforte Does a great job outlining the steps, but I needed to do an additional step for macOS 13.x. So, I thought I would consolidate here.
To install Flutter via Homebrew.
Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install fvm with Homebrew (this manages multiple versions of Flutter)
brew tap leoafarias/fvm
brew install fvm
Install the latest stable version of Flutter
fvm install stable
Append the path to Flutter to PATH by copying the line below into .zshrc (located in the home directory). IMPORTANT: Make sure to replace [USER_HERE] with your user name.
export PATH=$PATH:"/Users/[USER_HERE]/fvm/default/bin"
Reload .zshrc
source ~/.zshrc
Optional: Test Flutter installation.
flutter doctor

Installing mongodb on M1 mac

I tried opening the terminal using Rosetta but when I run brew install mongodb-community#5.0 I get an error that says:
Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)! To rerun under ARM use: arch -arm64 brew install ... To install under x86_64, install Homebrew into /usr/local.
However, when I run it as arch -arm64 brew install mongodb-community#5.0, it again complains with:
arch: posix_spawnp: brew: Bad CPU type in executable
Any help would be appreciated.
Thanks in advance.
There are two versions of brew:
Intel version (in /usr/local/homebrew)
ARM64 version for Apple Silicone (in /opt/homebrew/)
When you just type brew you are probably using native ARM64 version, for which there is no mongodb server yet.
You can check which version is your default with this:
$ which brew
/opt/homebrew/bin/brew
The solution I find most practical is to define alias for Intel brew like this in .zshrc:
# arm64/intel brew
alias brew86="arch -x86_64 /usr/local/Homebrew/bin/brew"
alias brewARM="/opt/homebrew/bin/brew"
# ARM64 brew is default
eval "$(/opt/homebrew/bin/brew shellenv)"
Then you can use intel brew to install intel based apps like this:
brew86 install mongodb-community
brew86 services
...
And you can use ARM64 brew to install native ARM64 stuff like this:
brew install mongosh
Important note - do not use "Open using rosetta2" to launch terminal window in which you gonna run these commands. You wish to be in native ARM64, then install Intel apps only when is absolutely needed with brew86.
For some reason even though I had Homebrew in /usr/local the one for M1 was being executed. Solved it by manually navigating in /usr/local/Homebrew/bin and running the commands with ./brew.

flutter doctor - CocoaPods installed but not working

using zsh - use to work in bash
brew doctor - Your system is ready to brew.
flutter doctor gives this error
[!] Xcode - develop for iOS and macOS (Xcode 12.2)
✗ CocoaPods installed but not working.
You appear to have CocoaPods installed but it is not working.
This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it.
This can usually be fixed by re-installing CocoaPods. For more info, see https://github.com/flutter/flutter/issues/14293.
To re-install CocoaPods, run:
sudo gem install cocoapods
sudo gem install cocoapods
Gives this error
dyld: Library not loaded: /usr/local/opt/gmp4/lib/libgmp.3.5.2.dylib
Referenced from: /Users/puser/.rvm/rubies/ruby-2.5.1/bin/ruby
Reason: image not found
zsh: abort sudo gem install cocoapods
I can't get this error above corrected - any suggestions?
which pod
/Users/puser/.rvm/rubies/ruby-2.5.1/bin/pod
which gem
gem () {
\typeset result
(
\typeset rvmrc
rvm_rvmrc_files=("/etc/rvmrc" "$HOME/.rvmrc")
if [[ -n "${rvm_prefix:-}" ]] && ! [[ "$HOME/.rvmrc" -ef "${rvm_prefix}/.rvmrc" ]]
then
rvm_rvmrc_files+=("${rvm_prefix}/.rvmrc")
fi
for rvmrc in "${rvm_rvmrc_files[#]}"
do
[[ -s "${rvmrc}" ]] && source "${rvmrc}" || true
done
unset rvm_rvmrc_files
command gem "$#"
) || result=$?
hash -r
return ${result:-0}
}
which ruby
/Users/puser/.rvm/rubies/ruby-2.5.1/bin/ruby
Using the suggestion for this post, I was able to get cocoapods reinstalled with the commands below
gem native extension error while installing cocoapods
Open Terminal
curl -L https://get.rvm.io | bash -s stable
Reopen Terminal
rvm install ruby-2.6
rvm use ruby-2.6.5
rvm --default use 2.6.5
Then this installed cocoapods as expected
sudo gem install cocoapods
Use brew and gem
first uninstall by gem
sudo gem uninstall cocoapods
Install cocoapods by brew
brew install cocoapods
link using brew
brew link --overwrite cocoapods
First install brew package manager for Mac.
https://brew.sh
If you use macOS, system Ruby is not recommended. and you should not use it. its for system specific use. you need to install another one for user.
brew install rbenv
then install the latest version of ruby. as today its 3.1.0
rbenv install 3.1.0
then set the global version of Ruby to be used in all shells
rbenv global 3.1
close the terminal and reopen it again, to affect the changes.
and finally install cocoapods
gem install cocoapods
as you see you don't use sudo command. because you are not overriding system specific configurations. when you need to use sudo command means you are doing something that you should avoid it.
if you are using fastlane and still complaining about cocoapods, even cocoapods is installed properly, reinstall fastlane again:
brew uninstall fastlane
gem install fastlane
curl -L https://get.rvm.io | bash -s stable
rvm install ruby-2.6
rvm use ruby-2.6.5
rvm --default use 2.6.5
sudo gem update
sudo gem install ffi
brew install libffi
sudo gem install cocoapods
pod setup
this worked for me
sudo gem uninstall cocoapods
rvm install 2.6.5
sudo gem install cocoapods
I am using MacBook Pro (2020) with M1 and following steps worked
url -L https://get.rvm.io | bash -s stable
rvm install ruby-2.6
rvm reinstall ruby-2.6.6
rvm use ruby-2.6.6
rvm --default use 2.6.6
sudo gem install cocoapods
Finally you can run flutter doctor to confirm.
flutter doctor
Output will be like this...
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.4, on macOS 12.4 21F79 darwin-arm, locale
en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version
32.0.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.68.1)
[✓] Connected device (1 available)
[✓] HTTP Host Availability
Please install latest version of ruby to solve this issue.
Use this command
rvm install ruby
rvm use ruby
rvm --default use
sudo gem install -n /usr/local/bin cocoapods
Just run this command for installing the latest version of coc
This error took me about one week to solve :(
The problem is mentioned clearly in the flutter output like this
This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it.
I had a lot of versions of ruby installed on my mac So this error happened to solve this error follow these steps
remove or uninstall cocoapods
remove all versions of ruby in your mac os except the system ruby version you can do that like this.
https://mac.install.guide/ruby/9.html#:~:text=Uninstall%20Ruby%20on%20Mac%20with%20rbenv,command%20to%20remove%20a%20version.&text=This%20will%20remove%20any%20gems,recommendations%20of%20newer%20version%20managers.
install ruby again using this link https://mac.install.guide/ruby/13.html
install cocoapods with this command :- brew install cocoapods

Grunt need compass installed in system PATH Warning

I want to install Yeoman, Grunt and bower to my node project.
I made a node project in Eclipse (using the nodeclipse plugin) and navigated to the project folder
(which is H:\Eclipse Workspace\YoTest) in cmd and typed in:
npm install yo -g
npm install generator-webapp -g
yo webapp
selected: Sass (with compass), in cmd
And then typed:
grunt serve
to run the webapp.
I get the following error message:
Done, without errors.
Warning: Running "compass:server" (compass) task
Warnin: You need to have Ruby and Compass installed and in your system PATH for
this task to work. More info: https://github.com/gruntjs/grunt-contrib-compass
Use --force to continue.
Aborted due to warnings. Use --force to continue.
Aborted due to warnings.
How do I fix this so that I can run my node project with grunt?
PS: I'm not sure if it has anything to do with the problem, but I also get the following errors on line 1-27 in my package.json:
Multiple markers at this line
- strings must use singlequote
- strings must use singlequote
This is my package.json
{
"name": "yotest2",
"version": "0.0.0",
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-compass": "~0.7.0",
"grunt-contrib-jshint": "~0.7.0",
"grunt-contrib-cssmin": "~0.7.0",
"grunt-contrib-connect": "~0.5.0",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-htmlmin": "~0.1.3",
"grunt-bower-install": "~0.7.0",
"grunt-contrib-imagemin": "~0.2.0",
"grunt-contrib-watch": "~0.5.2",
"grunt-rev": "~0.1.0",
"grunt-autoprefixer": "~0.5.0",
"grunt-usemin": "~2.0.0",
"grunt-mocha": "~0.4.0",
"grunt-modernizr": "~0.4.0",
"grunt-newer": "~0.6.0",
"grunt-svgmin": "~0.2.0",
"grunt-concurrent": "~0.4.0",
"load-grunt-tasks": "~0.2.0",
"time-grunt": "~0.2.0",
"jshint-stylish": "~0.1.3"
},
"engines": {
"node": ">=0.8.0"
}
}
I'm on Windows.
The warning seems to say it all.
If you're on OS X or Linux you probably already have Ruby installed; test with ruby -v in your terminal. When you've confirmed you have Ruby installed, run gem update --system && gem install compass to install Compass and Sass.
If that doesn't help, then install the grunt-contrib-compass package with the instructions at https://github.com/gruntjs/grunt-contrib-compass
I struggled for hours with this same error message when running a gulp watch, and despite installing, reinstalling, rebooting, it would still show up.
Got it working by uninstalling all my packages :
sudo gem uninstall bundler bundle compass sass compass-core compass-import-once
And installing bundle only
sudo gem install bundle bundler
And then run the command that magically installed everything I needed :
$ bundle
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/..
Installing sass 3.4.9
Installing sassy-maps 0.4.0
Installing breakpoint 2.5.0
Installing hitimes 1.2.2
Installing timers 4.0.1
Installing celluloid 0.16.0
Using chunky_png 1.3.3
Using multi_json 1.10.1
Installing compass-core 1.0.1
Using compass-import-once 1.0.5
Using rb-fsevent 0.9.4
Using ffi 1.9.6
Using rb-inotify 0.9.5
Installing compass 1.0.1
Installing json 1.8.1
Installing listen 2.8.3
Installing thor 0.19.1
Installing fontcustom 1.3.7
Installing modular-scale 2.0.5
Installing normalize-scss 3.0.2
Installing sass-css-importer 1.0.0.beta.0
Installing sassy-buttons 0.2.6
Installing susy 2.1.3
Using bundler 1.8.0
Bundle complete! 9 Gemfile dependencies, 24 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
Post-install message from compass:
Compass is charityware. If you love it, please donate on our behalf at http://umdf.org/compass Thanks!
Post-install message from fontcustom:
>> Thanks for installing Font Custom! Please ensure that fontforge is installed before compiling any icons. Visit <http://fontcustom.com> for instructions.
Now, don't ask me why, but it all works :-)
Hope that can help anybody out there, I really struggled on this one ...
Just need to write on console -> (or sudo )gem install compass ,because the npm command wouldn´t do anything
For Mac OS X 10.10 (Yosemite)
Search for installed ruby version
ruby -v.
If present
update gems using sudo gem update --system
else install rvm with ruby using
\curl -sSL https://get.rvm.io | bash -s stable --ruby
Then install the Xcode Command Line Tools
xcode-select --install .
This will take some time.
Now install compass using sudo gem install compass.
For me this worked like a charm.
Ruby and Ruby Gems ought to be installed which in turn facilitate the installation of Sass and compass. Check this out http://hecktechsolutions.blogspot.in/2015/03/installation-of-gems-compass-and-sass.html