Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )

Advanced DNS Management
New ZoneEdit. New Managment.


Sign Up Now
Reply to this topicStart new topic
> Bash- how to change default directory for a command
post Mar 24 2017, 03:15 PM
Post #1

Whats this Lie-nix Thing?

Group: Members
Posts: 1
Joined: 24-March 17
Member No.: 19,258

Firstly, I am new to Linux so excuse me if any terminology is wrong; I'll try to phrase the problem as competently as possible.

I have installed Ruby (2.4.0) via Linuxbrew. The ruby command works fine; it installed correctly. However, when I try to use the gem command (which Ruby should have installed) I receive this error: bash: /usr/bin/gem: No such file or directory

Now, because I installed this with Linuxbrew I know that this directory isn't correct. For example:

result of which gem : /home/me/.linuxbrew/bin/gem

result of which ruby : /home/me/.linuxbrew/bin/ruby

Therefore, it seems gem is installed but the gem command isn't linked to the correct path. I assume I need to direct the gem command to the path of which gem as opposed to /usr/bin/gem that bash is saying doesn't exist. How would I go about changing this? I tried in vain to change the bash_profile but I'm not sure what to do.

Again, excuse me if ruby and gem are not referred to as commands and if the problem isn't the "default directory" as stated in the title. I wasn't sure how to label it.

I'm sure it's an easy thing to fix, I just have no idea how to search for it!

Basically, how can I make gem execute this: /home/me/.linuxbrew/bin/gem instead of looking for the program in /usr/bin/gem?


My bash_profile contains "export PATH="$HOME/.linuxbrew/bin:$PATH" and .profile: PATH="/home/me/.linuxbrew/sbin:$PATH". echo $PATH also contains "/home/me/.linuxbrew/bin". I'm not sure why "gem" doesn't find the binary; it exists as I can run "/home/steve/.linuxbrew/bin/gem" without issues. All other packages in this folder work without prefixing the full directory; only "gem" and "rails" aren't found.

Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:


RSS Lo-Fi Version Time is now: 24th October 2017 - 02:47 AM