This content originally appeared on DEV Community and was authored by Anna Villarreal
I have been learning Ruby recently in an online environment. But I wanted to try to create and run an app from my local computer, using Ruby. I recently created a simple webpage for fun. I wanted to convert it to Ruby to really solidify those skills.
I had previously never messed with environment/system variables. This morning turned out to be a little more lengthy than anticipated. After cloning the project from github and putting it on my local editor, I created a gemfile and tried to "bundle install". I was wondering why it wasn't working. I kept getting messages in the terminal:
For some reason, I thought I had ruby installed on my local machine.
Turns out, I did not. Here is the can of worms. After 20 minutes of googling and this discovery, I install Ruby locally. Great. Ruby should work now, right?
Not quite. You didn't think it was that easy, right? I did! Turns out, I needed to do a few more steps. I'm going to give you the simplified version of my experience this morning. XD
After Installing Ruby
You may need to add a system environment variable manually as I did. Alright then. More uncharted territory! I learn that we can do so by accessing "Edit the system environment variables".
We then navigate to "Path" in System Variables:
With "Path" selected we click edit and then select "New"
Then we type in the executable path:
Finding your executable path
What is an executable path, and how do we find it? In order for Ruby to work in your program, you need to tell the system where to find this information. Open up your system terminal and type in "gem environment". This will give you the pertinent info.
Look for the little charmer called "EXECUTABLE DIRECTORY". This is the path you need in your new system variable. Mind your slashes, the system will not accept a copy-and-paste. Enter that as so:
Save everything and close. Restart your editor.
Now check that everything is properly setup:
Run "bundle install" in your editor terminal, given that you already have created a gemfile and such.
Magic! XD
I'm sure there is a fancy way to do this all in the terminal, alas, I am a beginner. Onward and upward!!
This content originally appeared on DEV Community and was authored by Anna Villarreal
Anna Villarreal | Sciencx (2024-08-23T14:44:35+00:00) Adding Ruby to System Environment. Retrieved from https://www.scien.cx/2024/08/23/adding-ruby-to-system-environment/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.