Skip to content

Instantly share code, notes, and snippets.

@hectorddmx
Last active October 25, 2023 16:39
Show Gist options
  • Save hectorddmx/805144a37c09d3cfe258783c9a9d7528 to your computer and use it in GitHub Desktop.
Save hectorddmx/805144a37c09d3cfe258783c9a9d7528 to your computer and use it in GitHub Desktop.
Remove homebrew cocoapods installation in catalina, and install directly from gem, zsh version
#! /bin/zsh
install_cocoapods () {
echo "Installing cocoapods with gem"
# Creating new gems home if it doesnt't exist
if [ ! -d "$HOME/.gem" ]; then
mkdir "$HOME/.gem"
fi
# Adding to current session
export GEM_HOME="$HOME/.gem"
export PATH="$GEM_HOME/bin:$PATH"
# Adding for future sessions
if test -f "$HOME/.zshrc"; then
echo 'Adding $GEM_HOME env var and then adding it to your $PATH'
echo '' >> "$HOME/.zshrc"
echo 'export GEM_HOME="$HOME/.gem"' >> "$HOME/.zshrc"
echo 'export PATH="$GEM_HOME/bin:$PATH"' >> "$HOME/.zshrc"
fi
# Installing cocoapods
gem install cocoapods
which pod
pod --version
}
uninstall_cocoapods_homebrew () {
which -s brew
if [[ $? != 0 ]] ; then
echo "Homebrew not installed, skipping uninstalling cocoapods from homebrew"
else
brew uninstall cocoapods
fi
}
if ! type "pod" > /dev/null; then
echo "You don't have cocoapods installed..."
else
echo "Trying to uninstall it from homebrew first"
uninstall_cocoapods_homebrew
fi
install_cocoapods
@thiago7almeida
Copy link

thiago7almeida commented Dec 7, 2022

it worked for me, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment