Installing Rbenv on a Mac - Beginner - ruby

I am new to Ruby and coding in general, and am trying to do a set of problems. However, I am unable to even get to the problems because the files I will be using require Rbenv and Bundler, and I cannot seem to install them on my Mac.
Can someone please give me a really simple explanation on how to correctly download the files (git ?) and install them via my terminal?
I have gone to github and downloaded the rbenv-master folder and saved it in a folder on my desktop. (https://github.com/sstephenson/rbenv)
I can open my terminal and navigate to this folder.
Should I be saving something from the entire folder differently and loading that?
If so, what do I save it as and what do I type in my terminal to load it?
Once I do that, do I have to do anything else (use the require command??) to use this in my exercises?
Thanks for taking the timeā€¦ I'll probably look back on this as a stupid questions. :)

You can just follow the homebrew install install instructions on the rbenv github page.
You just may need to install homebrew first if you don't have it. Which is a one-line command found on the homebrew homepage.

Related

How to fix bundle install after switching to zsh?

I recently switched from hdd to ssd so i had to reinstall everything from scratch since i wanted a clean ssd and not a clone of the hdd. I am trying to set my website locally but after switching from bash to zsh (using oh my zsh), I am getting the following errors when trying to bundle install (see picture). I have tried everything i found on the internet but nothing seems to fix the errors that pop when trying to manually installing eventmachine and http_parser.
https://i.stack.imgur.com/tEI32.png
Do i have to switch back to bash and reinstall everything? (a.i ruby, yarn etc.)
Thank you.
Fix : Deleting path for ruby gems from .bash_profile and adding it to .zshrc.
export PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:$PATH"

Installed rbenv and dugway but lost from there?

To cut a long story short this year I changed from PC to Mac and I've been asked to code a website for Big Cartel and I've an existing theme I'd like to edit.
Turns out getting dugway up and running on Mac isn't as straight forward as PC but none the less it has to be done.
I've got homebrew installed which allowed me to install rbenv along with the plugin.
From there I did the usual gem install dugway which went fine
But I'm confused why dugway create mytheme didn't work I got the error
-bash: dugway: command not found
I believe it's because I hadn't selected the directory but how do I do that?
Also does anyone know how dugway can unpack a theme downloaded?
Thanks

RVM causing path issues with installed gems on Ruby 1.9.2 - unable to annotate, etc, do I need to reinstall RVM?

I'm on Mac OSX Snow Leopard. I tried to post a similar question to the RVM Google group but it did not seem to get posted.
I'm worried that I've done something fundamentally wrong with my RVM install that's causing these errors, that seems to be related to paths, at each step of the way. Have any of you seen this behavior before?
I started to teach myself Rails programming as of about two months ago with a working environment of Ruby 1.9.1 and Rails 3.0.3, based on a hivelogic install tutorial that had me modify my ~/.profile file and install the relevant bits to ~/usr/local/src/. For reference, the line in my ~/.profile file was this when I installed RVM, if that makes any difference:
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/src:$PATH"
In my terminal I installed RVM as a user using the standard user github bash script.
I tried to install Ruby 1.9.2, which kept running into a weird error about a libfile somewhere. After much Googling I found someone on Stack Overflow that recommended renaming the ~/usr/local directory while performing the Ruby install -- I did this, and the install complete.
Then I did gem install rails and tried to do bundle install in my app, which gave an error when trying to install the SQLite3 gem (even though I already had SQLite3 installed and working). Again, I spent a day Googling this and eventually found "Unable to install sqlite3-ruby gem" that said if I used Macports to sudo port install sqlite3 it would work.
I tried that from the base directory, and Macports did its thing but it didn't fix the problem. Then I did the same thing from my app directory and it fixed the SQLite3 error I was getting.
Now I am able to run rails server and rails generate again, which is great, but then I tried to "annotate" my new model, and I get this error: http://pastie.org/1481570
I have not yet solved this issue, and have looked at many threads of similar issues. This, for example, did not solve my problem: https://github.com/james2m/annotate_models/commit/5997da9692c9b222e8d1be22dfad6ed8638c16a1
I even tried copying my source code directly into the rvm/user/ directory in case that relative path was causing problems, but it doesn't seem to have fixed anything. Maybe I need to uninstall RVM and re-install it as root instead of a user-level thing?
What do you think is the best way to get annotate to work and hopefully get RVM to play nice with my gems going forward?
I'm unfortunately REALLY new to terminal, code, etc, so any help would be much appreciated.
On Snow Leopard you should modify either ~/.bashrc or ~/.bash_profile, preferably the later. Also, RVM will not need anything in ~/usr/local since it's entirely self-contained in ~/.rvm.
RVM uses a nice little shell function to sense the needed directories and desired default Ruby. I suspect either the instructions you followed were very out of date, or poor recommendations. The current RVM installation requests you add:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
to your ~/.bash_profile
The RVM site has lots of troubleshooting tips for things like MySQL. I'd strongly recommend backing out of the things those other tutorials had you do, and refer to the instructions on RVM's site. It is very easy to get things working right if you do it the RVM-way.
Download and install Apple's latest version of XCode from their Developer site if you haven't already. There have been some broken versions shipped on the DVDs.
Install. In particular follow the "Post Installation" section.
Following that, do whatever rvm notes says to do as far as libraries. Following that, you should be able to use rvm info to gather useful info about your installation. It is your best friend.
Database integration will point you to how to fix MySQL's wagon.
RVM development happens fast. Keep it updated, at least once a week using rvm get head.
At that point you should be in a good place to start reinstalling gems.

I removed /etc/acpache2, how do I put back? (OSX)

Ok, so I was having some issues getting rails setup and I'm very new to this. I decided in the end to delete the apache2 folder in /etc as I thought that was created by the passenger-install-apache2-module, but apparently thats not so.
So... now I installed rvm, installed ruby, installed passenger, ran the rvmsudo passenger-install-apache2-module command and then went to edit the config file... but its not there.
So I clearly made a mistake deleting that. How do I put it back? More importantly, did I screw anything up?
Update for solution:
What I ended up doing was Archive and Install from the OSX DVD (I'm using snow leopard so I had to do this manually). I probably could have used Pacifist to just install apache, not sure if thats possible but found out about it after I did the archive install.
You could try re-installing apache2.

Local installation of ruby / rubygems with no root access

I have a machine at work from wich I'd like to run a script that gathers some information about other machines. I want to do it in Ruby, since it's what I know best, but I've ran into some problems, all apparently due to the same reason: I don't have root access in this machine.
So what I did was: Download ruby source, configure (with --prefix pointing to somewhere under my home dir), make, make install. Alright, ruby runs fine. Then I did the same with rubygems and installed it. Ok as well, untill I went to install my first gem.
I downloaded the gem package (sigh, lots of firewalls, can't just "gem install" something remote), net-ssh, and tried to install it locally. Got the infamous "no such file to load -- zlib". Clues about this led nowhere, so I tried the next approach: getting net-ssh's source. When it tries to require 'openssl' (or when I try it from irb), I get "no such file to load -- openssl".
All of these problems, apparently, could be solved by apt-getting or rpm installing, or whatever. Only problem is: I can't!
Any suggestions as to how I might proceed?
Thanks for the help,
Marcelo.
Closing this now.
I had to ask someone with root access to install zlib-devel and openssl-devel (I'm on RHEL). Couldn't make it otherwise.
I'm guessing there's probably a way of using the stuff inside said packages without installing them as root, but I couldn't do it.
Did you try Ruby RVM?
You can download, compile and install a full-featured Ruby version on your home environment.
I recently did the same. The trick that worked for me is NOT to use a --prefix flag when you install rubygems.

Resources