Last active
November 15, 2023 18:10
-
-
Save claybridges/c289d5fa6e3e386e8921 to your computer and use it in GitHub Desktop.
Use rvm in a shell script
This file contains 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
#!/usr/bin/env bash | |
# Xcode scripting does not invoke rvm. To get the correct ruby, | |
# we must invoke rvm manually. This requires loading the rvm | |
# *shell function*, which can manipulate the active shell-script | |
# environment. | |
# cf. http://rvm.io/workflow/scripting | |
# Load RVM into a shell session *as a function* | |
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then | |
# First try to load from a user install | |
source "$HOME/.rvm/scripts/rvm" | |
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then | |
# Then try to load from a root install | |
source "/usr/local/rvm/scripts/rvm" | |
else | |
printf "ERROR: An RVM installation was not found.\n" | |
exit 128 | |
fi | |
# rvm will use the controlling versioning (e.g. .ruby-version) for the | |
# pwd using this function call. | |
rvm use . | |
# aaaand your stuff here! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I copy this whole file into run script but not working on Xcode8?