tags:

views:

83

answers:

1

I'm not looking to keyword spam here, and this question is in the least tangential to a previous question of mine that's currently pending. Caveat emptor.

Most references to Ruby on the Mac have things set up with the conventions mentioned in this question. Stored in /Library/, that is. My whole setup is somehow stored like this:

My default opt Rails setup

I'd like to understand the differences here and what on earth I did to end up with things stored in /opt/. Did it have anything to do with installing MacPorts?

And if there's not a good reason for this setup, I'd love to move in a more conventional direction. I'm pretty sure I have extra copies of at least some things lying around with things organized in this manner. And I know some important things are stored in /Library/ (my Less.CSS gem for one).

Thanks so much for any insights you can give.

+3  A: 

MacPorts installs itself, as well as its ports, under /opt/local, to avoid "polluting" /usr, /usr/local, etc. If you installed RubyGems via MacPorts, it'll exist under /opt/local; likewise, any gem you install (globally) will also be under /opt/local.

If you install RubyGems manually, or use the version that ships with OS X, it'll install gems under /Library instead. That's why some tutorials reference /Library instead of /opt/local.

If you use a version of Ruby provided by MacPorts, it's probably easier and better to store gems under /opt/local; conversely, if you use the Ruby that ships with OS X, or you installed your own version, it might be better to keep gems under /Library. But it doesn't matter which place you keep them, or whether you have gems spread across both directories.

mipadi
Great explanation, mipadi! Can I change my Macports setup to install gems in /Library if I'm going to use the Ruby that ships with OSX? It's good to know that gems are accessible across both directories, that helps my other question. I'm essentially just getting my feet wet in Ruby and am looking to make sure I'm using best practices, and having things spread across two directories seemed messy at first.
Joshua Cody