Adding Ruby to System Environment

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.


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:

error message

For some reason, I thought I had ruby installed on my local machine.

anime girl thinking

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".

environment variables

We then navigate to "Path" in System Variables:

system variables

With "Path" selected we click edit and then select "New"

new variable

Then we type in the executable path:
type in 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.


executable directory

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:

variable added

Save everything and close. Restart your editor.


Now check that everything is properly setup:
check install

Run "bundle install" in your editor terminal, given that you already have created a gemfile and such.

bundle install

Magic! XD

walking towards light
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


Print Share Comment Cite Upload Translate Updates
APA

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/

MLA
" » Adding Ruby to System Environment." Anna Villarreal | Sciencx - Friday August 23, 2024, https://www.scien.cx/2024/08/23/adding-ruby-to-system-environment/
HARVARD
Anna Villarreal | Sciencx Friday August 23, 2024 » Adding Ruby to System Environment., viewed ,<https://www.scien.cx/2024/08/23/adding-ruby-to-system-environment/>
VANCOUVER
Anna Villarreal | Sciencx - » Adding Ruby to System Environment. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/08/23/adding-ruby-to-system-environment/
CHICAGO
" » Adding Ruby to System Environment." Anna Villarreal | Sciencx - Accessed . https://www.scien.cx/2024/08/23/adding-ruby-to-system-environment/
IEEE
" » Adding Ruby to System Environment." Anna Villarreal | Sciencx [Online]. Available: https://www.scien.cx/2024/08/23/adding-ruby-to-system-environment/. [Accessed: ]
rf:citation
» Adding Ruby to System Environment | Anna Villarreal | Sciencx | 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.

You must be logged in to translate posts. Please log in or register.