Skip to content

Loading…

final step requires sudo for install of bundler, rails, heroku, tap and pg #12

Closed
durrantm opened this Issue · 15 comments
@durrantm

I bought a new Mac Air on 10/2/2011
These instructions are very helpful.
An issue that I found is that the last step, running the script to install bundler, rails, heroku, tap and pg fails with permission issues.
So I am running the steps to install the components manually with sudo

Installing Bundler for managing Ruby libraries ...
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.
Installing Rails to write and run web applications ...
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.
Installing the Heroku gem to interact with the http://heroku.com API ...
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.
Installing the Taps gem to push and pull SQL databases between development, staging, and production environments ...
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.
Installing the pg gem to talk to Postgres databases ...
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.

@ntulip

I would love to see if anyone could spend 2 minutes to possibly help fix this. I am getting the same error.

@croaky
thoughtbot, inc. member

It shouldn't be necessary to sudo. These commands should be run in the context of the rvm'ed Ruby 1.9.2. I'm not sure what the cause of the problem is here.

@ivanovv

the cause, i think, is this error

Install of ruby-1.9.2-p290 - #complete 

RVM is not a function, selecting rubies with 'rvm use ...' will not work.
@kurtzilla1

I am having this issue as well

@ivanovv

@kurtzilla1, do you have Zsh as your shell? I do. Maybe that's the problem, script expects bash shell?

@kelsmj

I have tried running the laptop script in both bash and zsh...whenever it tries to source the .zshrc it fails. I think this is the root cause, because when it tries to install rails, it thinks it is in hash mode, instead of function mode.

@drapergeek
thoughtbot, inc. member

I tried running it in zsh as well as bash and ran into the same thing. Any chance that it has something in the thoughtbot dotfiles that it relies on to make this work properly?

@sethvargo

This is actually an rvm issue with the new rvm-installer

@hsoi

FWIW, the script mostly runs and just fails when it starts to do the "ruby" portion of things.

In the "ruby" script there is this:

echo "Installing Ruby 1.9.2 stable and making it the default Ruby ..."
  rvm install 1.9.2-p290
  rvm use 1.9.2 --default

and the "use" is the place where it chokes.

I'm running with Xcode 4.3.x installed, so after the script choked I just ran:

bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)'

to ensure I had the right rvm

Because of the Xcode 4.3.x install, I do not have "autoreconf", so I had to get that:

brew install automake

(thankfully, brew was already installed when this "laptop" script ran, so this worked out fine).

then

rvm install 1.9.3 --with-gcc=clang

and

rvm use 1.9.3

In fact, I ensured it was the default

rvm --default 1.9.3

Check the version of ruby, all was good.

Then I just ran the rest of the commands in the "ruby" and "heroku" scripts... the scripts are simple, just a bunch of echo's and "gem" or "heroku" commands. So just ran them all manually.

Seems to be alright.... seems to be.

@glennfu

hsoi's tips seem to have solved the issue for me as well. However I still needed to follow all of the instructions at http://tammersaleh.com/posts/installing-postgresql-for-rails-3-1-on-lion to get postgresql working.

@adarsh

I also got this to work on Lion using the --with-gcc=clang option and the gcc command line installation (as opposed to full Xcode).

So why not something like this:

echo "Installing Ruby 1.9.2 stable and making it the default Ruby ..."
  #if Lion, then do these
  rvm get head
  rvm install 1.9.3 --with-gcc=clang
  rvm use 1.9.2 --default

  # If not, then...
  rvm install 1.9.2-p290
  rvm use 1.9.2 --default

Were I better at scripting, I would patch this myself. I do know OS X version number is available using defaults read loginwindow SystemVersionStampAsString # => 10.7.4

@durrantm
@adarsh
@mike-burns
thoughtbot, inc. member

These shell actions should only proceed if they succeed. The simple way is to use && at the end of every line, but alternatively:

successfully() {
  $* || (echo "failed" 1>&2 && exit 1)

}

means that we could do

successfully rvm use 1.9.2
@croaky croaky added a commit that referenced this issue
@croaky croaky [#12] Use clang to install Ruby 1.9.2 57e5966
@croaky
thoughtbot, inc. member

I believe the option that solves it is --with-gcc=clang. Pushed and closing.

@croaky croaky closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.