Last active
October 25, 2023 16:39
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it worked for me, thanks!