Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing Cocoapods without Homebrew #311

Open
pfumagalli opened this issue May 14, 2024 · 0 comments
Open

Installing Cocoapods without Homebrew #311

pfumagalli opened this issue May 14, 2024 · 0 comments

Comments

@pfumagalli
Copy link

#### Installing CocoaPods without Homebrew
You can install CocoaPods directly with Ruby Gem. To install it, you can run the following command.
```
sudo gem install cocoapods
```
However, installing CocoaPods this way **will not** work on Apple Silicon Macs. You will need to run CocoaPods through Rosetta enabled. To do this, you can run the following commands.
```bash
sudo arch -x86_64 gem install ffi
```
Then, whenever you want to update your application to use a newer version of your web code, you will need to run the following commands.
```bash
npx cap copy
arch -x86_64 pod install
```

It seems this section is a bit outdated. I managed to install CocoaPods with the built-in ruby on Sonoma on a M2 (ARM).

If you want to include this in the docs, here's my take on it:

Installing CocoaPods without Homebrew or sudo

You can install CocoaPods directly with the Ruby bundler shipped with MacOS and without needing sudo support.

First of all decide where to store the Ruby gems (in this example under ~/.gem), then set the GEM_HOME environment variable and update your PATH (you can also add this to your .bashrc or other login script you use).

export GEM_HOME="${HOME}/.gem"
export PATH="${PATH}:${GEM_HOME}/bin"

You can then use the bundle command to create a small Gemfile and install Cocoapods:

$ bundle init && bundle add cocoapods

Compared to the gem install command, using bundle with a Gemfile will resolve all dependencies considering the currently installed version of Ruby and RubyGems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant