How do i install Command-T, Pathogen, and not using RVM? - ruby

I used brew install to install ruby (as opposed to RVM). I have on my system installed ruby 1.9.3p0. (OSX Lion)
I'm trying to install Command-T via pathogen. I can normally run rake, make, ruby, whatever, but when i enter into the 'Command-T' directory and try to run rake make it says Could not find rake-0.8.7 in any of the sources.
I also cant run any normal ruby command. just ruby --version produces the same errors.
I know this has to do with below... but i dont know how to actually fix it.
Most installation problems are caused by a mismatch between the
version of Ruby on the host operating system, and the version of Ruby
that Vim itself linked against at compile time. For example, if one is
32-bit and the other is 64-bit, or one is from the Ruby 1.9 series and
the other is from the 1.8 series, then the plug-in is not likely to
work.
As such, on Mac OS X, I recommend using the standard Ruby that comes
with the system (currently 1.8.7) along with the latest version of
MacVim (currently version 7.3). If you wish to use custom builds of
Ruby or of MacVim (not recommmended) then you will have to take extra
care to ensure that the exact same Ruby environment is in effect when
building Ruby, Vim and the Command-T extension.
I tried temporarily moving the entire Cellar directory out of /usr/local (for those arent familiar, its where homebrew installs ruby and everything else).
In terminal if i run which ruby it works right.. yet when i rune rake make in the Command-T folder it still gives the same error

nevermind... all i had to do was run /usr/bin/rake make
how thats different than just removing the Cellar folder temporarily so that by default shell uses that path, i have no idea, but it worked.

I had similar problem on Fedora.
In the end, I found we should install rubygem-rake and ruby-dev package first.
After installing both, compile your Vim with "./configure --enable-rubyinterp",
then Commend-T will be ok.

Related

How to set up Ruby on OS X with Nix instead of Homebrew?

I switched recently to the Nix package manager instead of Homebrew for OS X.
Usually, I install it with rbenv like:
brew install rbenv
rbenv install 2.2.0
I am asking myself now how does one do it with Nix? I've heard Nix itself is a good enough package manager, so maybe I can get rid of rbenv for handling my ruby version?
When I install ruby via Nix
nix-env -i ruby
Even when OS X recognises it:
$ which ruby
/Users/USERNAME/.nix-profile/bin/ruby
I am still getting a Permission denied error when trying to:
gem install sass
Would you still recommend rbenv for handling ruby installations? I
know I could just chown the Nix folder, but I should own it anyway.
I've had similar experience using python with nix.
Generally the approach when using nix is NOT to:
Install a language specific package manager for some version of a language (gem, pip, ...)
Use that language specific package manager to install libraries
Instead the nix way (from what I've learned) to do things is:
Install all already packaged applications with nix
If you are developing an application, instead of installing the libraries your application depends on via nix (or gem), you define a nix expression that describes your applications dependencies and use it as a development environment. (I think the documentation should be improved in this matter.)
Generally don't install libraries on their own and manually refer to those in some third-party build process. (This works in some scenarios, as in compiled C/C++ libraries, where dependencies of the libraries are built into them via RPATHs. But this does not work well with e.g. python packages.) In the end what you really want is the application, not the library!
You can find some documentation on how to set up such environments in the official nixpkgs documentation, mostly covering Haskell at the moment, but Ruby should be similar.
you can found package of ruby by following
nix-env -qa ruby
and then it will shows list of ruby versions
nix-env -i ruby-2.1.0-p0
This will install ruby version then check it by ruby -v

Why doesn't rails.vim recognize any gems that I install?

I'm a ruby and vim newbie. I recently installed the rails.vim plugin and all the commands work fine apart from the commands to create a new Rails project. Every time I do this it says rails is not installed on my system, but it is! It also acts up when I create a class that requires a gem that I've installed. Can anyone help with this?
Did you rvm use system before building / brew install-ing macvim? I didn't and got many errors. Doing rvm use system beforehand fixed things up for me.

Installing Ruby on Mac 1.9.2, still getting 1.8.7 even though path changed

I'm on a Mac running 10.6.4 Snow Leopard, and apparently ruby comes ready to go. But I'm new to Ruby, trying to learn the Rails framework, and so i decided to install the latest version 1.9.2. I followed the instructions here, but after I compile and install, when I run ruby -v I'm still getting 1.8.7. Anyone can help a noob out?
When I use which ruby I am getting usr/local/bin/ruby, so the path has changed and is correct.
UPDATE:
It seems I was having issues because I was using two login files to set my path (.bash_login and .profile). You can only use one, and the first one that exists and is readable will be used. I eventually switched to RVM and used .bash_login to load RVM into shell.
Well, the sw isn't lying to you. So something is not as you expect.
Try /usr/local/bin/ruby -v and see what version it is.
Added: Also, try locate ruby|more to see where the ruby files are on your system.
You may need to change your path to use your newly installed copy of ruby.
Added more: did you add the Path to your ~/.profile file as the instructions tell you to do in step 1?
Did you restart your terminal session after changing the ~/.profile file? (Quit and restart terminal.)

How does MacPorts install packages? How can I activate a Ruby installation done via MacPorts?

After trying to install ruby19 on my machine (PPC, Mac OSX 10.5.7) using the following commandline
sudo port install ruby19
the version of ruby didn't change
ruby -v => ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0]
I assume that i have two versions of it installed on my mac, but how do i use the latest one now?
By default, the Ruby 1.9 port in MacPorts installs the Ruby binary in /opt/local/bin/ruby1.9. It appends a 1.9 to avoid stomping on Ruby 1.8.7 libraries and gems, since not all gems are compatible with 1.9 yet. So you have to launch Ruby 1.9 with ruby1.9 (and irb1.9, etc.)
If you don't want to have to do this, you have two options:
Alias ruby to ruby1.9 in your shell config file.
Install the Ruby 1.9 port with the +nosuffix variant. Be warned, however, that if you have installed Ruby 1.8 via MacPorts, installing Ruby 1.9 via MacPorts without the 1.9 suffix may cause conflicts (with gems, etc.).
To use a specific ruby version if you have two versions installed you can either specify an absolute path to the one you want. E.g. /your/path/to/ruby Or you can change your PATH setting in your .profile
you can type
which ruby
to see the path to the ruby executable that is used at the moment.
using
echo $PATH
You can see the current PATH setting. You have to prepend the path to your new ruby binary to the PATH so that it will be found before the other one.
As ayaz already mentions, the default location of your macports stuff is in /opt/local. If you add /opt/local/bin in front of your path it should be fine. (Make sure to start a new terminal window after the change - they will not be picked up in your current session unless you explicitely 'source' the .profile file again)
One note of caution: after prepending /opt/local/bin to your path the shell will always prefer binaries in there to binaries found later, this can be an issue if you depend on specific versions in /bin, /sbin or /usr/sbin -- depending on your situation this means that you should not do it (if your computer is processing sensitive data and/or in a bank or something) or just have to remember that it could be an issue (if your computer is a normal development machine).
See http://www.tech-recipes.com/rx/2621/os_x_change_path_environment_variable/ if you need some more hints on how to set your PATH on osx.
Just a quick clarification about MacPorts. Ayaz is right that, by default, MacPorts will install things in /opt/local. (This makes it easy to globally uninstall later, if you want, and it keeps MacPorts packages out of the way of OS X packages.)
When you install MacPorts, it will normally edit your $PATH (and your $MANPATH) for you by updating your user's .profile (creating it, if it doesn't already exist).
As a precaution, the installer will create a backup of the original .profile in case you want to roll back the changes (or if you completely uninstall MacPorts later). Here's an example from a random machine at work.
admin ~ $ ls .profile*
.profile .profile.macports-saved_2009-08-03_at_14:55:56
If you look in .profile you should see something like this:
##
# Your previous /Users/admin/.profile file was backed up as /Users/admin/.profile.macports-saved_2009-08-03_at_14:55:56
##
# MacPorts Installer addition on 2009-08-03_at_14:55:56: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
# MacPorts Installer addition on 2009-08-03_at_14:55:56: adding an appropriate MANPATH variable for use with MacPorts.
export MANPATH=/opt/local/share/man:$MANPATH
# Finished adapting your MANPATH environment variable for use with MacPorts.
If your $PATH hasn't been updated, you should adjust it, since otherwise, you will have trouble using the port tool and the software you install via MacPorts.
I am inclined to think that macports usually keeps all of its stuff inside the /opt/local directory. I am using Leopard, and I have it inside that directory. You may want to look in there, particularly inside /opt/local/bin, to find the ruby binary you are looking for.

RubyGems via MacPorts a good idea?

Upon upgrading from a MB to a new MBP, Apple's migration assistant didn't move my gems.
I'm installing rubygems via macports this time, hoping to avoid this upon next upgrade.
Are there any pitfalls I should be aware of?
If you want your gems installed in your home directory (which should copy over during a transfer, and, as a side benefit, will let you run gem install as yourself, rather than root), set the gemhome: key to a path in your home directory in your ~/.gemrc.
Where were your gems installed? The migration assistant only moves files in certain areas; I'm not sure if it copies files from places like /usr/local or /opt/local, you may have to do that manually (in which case, you can just copy the entire tree over to your new machine).
That said, you shouldn't have a problem installing gems using the version of RubyGems installed by MacPorts.
Installing a package manager via a package manager seems like it should be wrong.
Assuming you are not going to use the system ruby, and will only be using ruby installed via MacPorts; it should not be a problem.
If you plan on using gems with system ruby, you might have problems when Apple upgrades the system version of ruby, unless you are installing your gems in /Library/Ruby/Gems/
I'm going to assume you can just copy the gems to /Library/Ruby/Gems/1.8/gems from /opt/local/lib/ruby/gems but I wouldn't count on it working 100% with every gem.
The migration assistant doesn't move a lot of unix level stuff. This will be true of the macports installed gems as well (which typically live in /opt/local/lib/ruby/gems).
I use macports gem, and this generally works fine with the macports ruby. Be sure you know which ruby executable your shell ends up using, and perhaps use symlinks to control it specifically. I prefer using the macports version so that I'm not beholden to Apple's update schedule. Sadly macports iteself is somewhat inferior to package managers offered on bsd/linux distributions.
I would say don't use MacPorts. People that use their operating systems version of RubyGems often end up with an out of date gem version and then run into problems when they try to update their version of rubygems. Installing Rubygems from source is easy, and it's not hard to install gems when you get a new machine, I mean how often does that really happen????
I just installed ruby 1.8.7 with macport and when I launch scripts with gems, it complains that it doesn't know them.
Anyway to add cleanly the gems in the path of my macport ruby?
Gam
PS: I installed the gems via system gem
What no one mentioned rvm?
Use rvm to manage all of your ruby issues - seriously!

Resources