Skip to content

Commit

Permalink
Restart shell as login shell after rbenv
Browse files Browse the repository at this point in the history
Move `exec $SHELL -l` line to spot recommended by [rbenv README][1].

Resolves [#77][2], where users would see errors like:

    Updating rubygems-update
    ERROR: While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /Library/Ruby/Gems/1.8
    directory.
    failed
    Installing critical Ruby gems for Rails development ...
    ERROR: While executing gem ... (OptionParser::InvalidOption)
    invalid option: --no-document
    failed
    Installing GitHub CLI client ...
    ERROR: While executing gem ... (OptionParser::InvalidOption)
    invalid option: --no-document
    failed

[1]: https://github.com/sstephenson/rbenv/
[2]: #77
  • Loading branch information
Dan Croak committed Apr 10, 2013
1 parent 1ed31e7 commit 2b1136e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions mac
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ echo "Installing watch, used to execute a program periodically and show the outp
echo "Installing rbenv for changing Ruby versions ..."
successfully brew install rbenv
successfully echo 'eval "$(rbenv init -)"' >> ~/.zshrc
successfully source ~/.zshrc

echo "Restarting shell as a login shell so path changes take effect to begin using rbenv ..."
exec $SHELL -l

This comment has been minimized.

Copy link
@croaky

croaky Apr 10, 2013

Contributor

The script stops after this step now, meaning Ruby is not installed. Any thoughts on how to get the script to continue or do we need to fall back to having the user run two scripts manually?

This comment has been minimized.

Copy link
@jferris

jferris Apr 10, 2013

Contributor

exec replaces the current process with a processing running the given command, so the rest of the script is never reached.

If you split the rest of the script into a new file, you can run it by using $SHELL -l -c [COMMAND].

You may also be able to source something in the script here instead of running exec.

This comment has been minimized.

Copy link
@croaky

croaky Apr 10, 2013

Contributor

Yeah, I ended up sourcing ~/.zshrc instead.


echo "Installing rbenv-gem-rehash so the shell automatically picks up binaries after installing gems with binaries..."
successfully brew install rbenv-gem-rehash
Expand Down Expand Up @@ -95,6 +97,3 @@ echo "Installing Heroku CLI client ..."

echo "Installing the heroku-config plugin for pulling config variables locally to be used as ENV variables ..."
successfully heroku plugins:install git://github.com/ddollar/heroku-config.git

echo "Your shell will now restart in order for changes to apply."
exec $SHELL -l

0 comments on commit 2b1136e

Please sign in to comment.