I'm using cygwin and install on them ruby, so cause I don't have much experiences with ruby I always get much error that those version is buggy to use fix, and many more... So my question is what version of ruby use with cygwin, that bypass all those problems?
I recommend installing the latest version from rubyinstaller.org as well as the devkit from the same page.
When you install it choose the option to add ruby to your path.
To get gem and the other batch files working correctly from cygwin you can add something like this to your .bash_profile:
ruby=`which ruby|perl -pe 's/\/[^\/]*$//'`
for i in `/bin/ls -1 $ruby/*.bat`
do
alias `basename "$i" .bat`=$i
done
Related
I want to get list of all installed packages on my machine using ruby gem or plugin. Functionality is similar to dpkg -l command on ubuntu. Is there any appropriate ruby gem or plugin available to get the same?
If you mean Ruby gems, then
gem list
You can execute a shell command inside the ruby interpreter. In your case, simply run
`dpkg -l`
The output will be a string containing the output of the command. Please note the `.
Keep in mind there are several ways to perform a shell command in Ruby.
There is a Debian package called ruby-debian (in older Debian releases it is called dpkg-ruby) which contains Ruby bindings to dkpg.
Note: it relies on a C extension, so it will not work on Ruby implementations that don't support them, such as IronRuby.
I'm using rvm on ubunut 13.04. Today I updated ruby with latest 1.9.3 version.
Now, when I try to start vim I get:
vim: error while loading shared libraries: libruby.so.1.9: cannot open shared object file: No such file or directory.
ldd $(which vim) | grep ruby gives libruby.so.1.9 => not found
Any idea how to fix it?
The Vim binaries are compiled against a particular Ruby (, Python, Perl, etc.) version. If that version vanishes, the integration is broken.
You can try to put back the required library with a link (something like libruby.so.1.9 -> libruby.so.1.9.3). If that fails, you have to find a corresponding Vim version or compile Vim yourself.
I was having trouble getting jekyll to work with Ruby using cygwin on Windows 7 64-bit. I had better results using rubyinstaller + devkit. It would be really nice if I could use the rubyinstaller ruby inside of cygwin.
However, I get the following message when I try to execute rake.
$ rake page name="pages/about.md"
C:\Ruby193\bin\ruby.exe: No such file or directory -- /cygdrive/c/Ruby193/bin/rake (LoadError)
Is there any way to make rubyinstaller play nice with cygwin?
I just put a few of these in my .bash_profile:
alias gem=gem.bat
alias irb=irb.bat
alias rake=rake.bat
I never have any of the problems that Luis mentions.
The problem is cygwin converting all the scripts paths into cygwin paths (/cygdrive/...).
There is no solution for that since the invoke of the script is made from bash over rake scrip which invokes native Ruby.
There are a lot of other issues that cygwin will cause, and some are covered in RubyInstaller troubleshooting page
One alternative will be invoking rake.bat directly, skipping cygwin shebang detection.
But cygwin doesn't like batch files, which forces you to do cmd.exe /C rake.bat and that is a noisy command line.
The other alternative is install something like gem-exefy (gem install gem-exefy) and generate executables for your installed gems (rake.exe).
That way you invoke rake.exe instead of letting cygwin figure it out.
Another alternative is use MSYS Bash (included in DevKit) instead of cygwin, which plays way better than cygwin one, but you will still have issues with batch files.
As you can see, mixing non-native (cygwin) with native (RubyInstaller) have a lot of side-effects.
I have to run a Rails (3.0.6) app locally that requires Ruby 1.9.2 (plus Mongo). I'd like to install Ruby 1.9.2 alongside my existing 1.8.7 and be able to swap between them as necessary. I prefer installing to usr/local over Macports etc. Any recommendations? I've tried installing RVM but this has proved such a pain on OS X I'd rather avoid that too.
Is there another way of running multiple Ruby versions (maybe with a prefix like this)? I only need to switch to 1.9 for this project. Or has anyone a good solution to the known OS X/RVM install issues? Specifically, on Tiger/10.4 bash doesn't support errtrace.
Update: solved with a new RVM install script: see RVM on OS X 10.4 - possible?.
RVM really is the easiest solution, and I would highly recommend you try and work that issue out first.
The only bit of advice is to make sure you configure your PATH variable to include /usr/local/bin before everything else. In your .profile or .login (depending on your shell), you should have it towards the bottom, in case there is any other lines configuring PATH as well, and then for the Bourne shell family:
export PATH="/usr/local/bin:$PATH
or for the C shell family:
set path = (/usr/local/bin $PATH)
Running ./configure alone should make it install into /usr/local, but you can explicitly state so with
./configure --prefix=/usr/local
Install Ruby from source and it will default to /usr/local/bin. Adjust your path, the #! line, or your /usr/local/bin/ruby source.rb as necessary to switch between Apple's installation of Ruby, and the one you add.
You can force a new base directory using ./configure --prefix=/... where '...' is whatever path you want. Again, once the files are installed, you can adjust the executing Ruby with one of the above methods.
Do not attempt to remove Apple's installed Ruby. It's there for their use, not for our convenience, and Apple uses it to provide some functionality. Messing with it or removing it could break things, and you probably wouldn't notice for a while.
RE: RVM, It really is the preferred way to install a user Ruby. I have it on two Macs, and a handful of different Linux boxes and the only time I had trouble was with a secured machine behind firewalls, but I can't blame RVM for those problems when it couldn't see the internet at all. And, yes, I got it working nicely, I just had to insert the manually downloaded Ruby archives into the ~/.rvm/archives directory.
If you are having problems and want to use it, it might help to temporarily strip your startup scripts, or create a temporary user, and see what happens. Additionally, the author has been very responsive and helpful the few times I've asked him questions. Contact him at:
If you still cannot find what an answer to your question, find me 'wayneeseguin' in #rvm on irc.freenode.net:
http://webchat.freenode.net/?channels=rvm
If you download the source and compile it, it should install into /usr/local by default, or you can
./configure --prefix=/usr/local
just to be sure.
Actually, compiling and installing ruby from source is an easy way to be sure you have the latest version, especially if you use git and github:
https://github.com/ruby/ruby
I have two related questions that I was hoping someone could help out with.
I recently installed Ruby 1.9.2 on my Mac (running Snow Leopard 10.6.4) and I haven’t been able to figure out how to get Terminal to use the new Ruby as a default, rather than the factory-installed Ruby 1.8.7. The old Ruby 1.8.7 is located in my ~/usr/bin/ruby directory while the new Ruby 1.9.2 is in ~/usr/local/bin/ruby. Someone said that I need to put the new version of Ruby's directory in the PATH prior to the old version's directory so that the system looks there first - is this correct? If so, can anyone provide step by step instructions on how to do this?
I’ve created a new directory but can’t seem to figure out the correct way to add that directory to my PATH using the Terminal bash shell. I tried using the instructions that I found here (http://www.macgasm.net/2008/04/10/ad...thin-terminal/) twice but they didn't work for me. The directory containing my program ("Ruby_Programs") shows up in the PATH but when I try to run "ruby newprogram.rb" from the command line it results in ":ruby: No such file or directory -- newprogram.rb (LoadError)". The file definitely exists and is a functional Ruby program. I did change the name of the directory to "Ruby Programs" and then back to "Ruby_Programs" - could that have somehow caused this problem?
Any help would be greatly appreciated. Here is my current PATH:
$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/sbrriffe/src:/usr/X11/bin:/Users/sbriffe/Ruby_Programs/:
You might want to check out rvm. You can install multiple versions of ruby side by side and easily switch between them. If you follow the rvm installation notes you won't have any more path problems.
Your Ruby Programs directory shouldn't be in your path: the location of your ruby interpreter should be. Then, you cd to the location of your ruby program, and run it from there: ruby program.rb.
Since you are on a Mac, check out homebrew for something that will make installing software easier. I have my homebrew set up in /usr/local, and it works great.
Once you have installed stuff where you need it, then you'll want to adjust your $PATH. The items in $PATH are searched in the order they appear, so in your ~/.bashrc, you'll want to add:
export PATH=/usr/local/bin:$PATH
To make sure /usr/local/bin gets searched before /usr/bin.
I would use RVM to get everything installed, and then once you have RVM installed it is easy to set your default Ruby version.
Check out https://rvm.io/ -- once you have that installed you can change your default by using : $ rvm use 1.9.2 --default
hope that helps- you can do this with any version, not only 1.9.2