.bash_profile conflicting with .profile preventing node from running - node.js

I have my ruby environment set up in .bash_profile and MacPorts installed in .profile, as per its instructions. I've installed node using MacPorts, but it seems like there's a conflict between .bash_profile and .profile. Node worked upon installation, but it hasn't worked since unless I delete .bash_profile or load .profile in the terminal.
I'm still new to setting up environments, so I'm not sure if I can essentially combine .bash_profile and .profile to avoid this conflict or if there's a better solution.

You can move the modifications MacPorts requires to $PATH wherever you want. If that fixes the issue, move them to .bash_profile.
Take a look at the value of $PATH when your setup works vs. when it doesn't. I assume whatever ruby environment you are using is changing it in some way. Adding the following line at the end of your .bash_profile should make it work again:
export PATH=/opt/local/bin:$PATH

Related

EMCC not found - only works in emsdk not globally in terminal

I am a new Linux user and am looking to get the emscripten emcc command to work globally on Ubuntu.
This is my current configuration:
LLVM_ROOT = '/home/mpaccione/Projects/emsdk/upstream/bin'
BINARYEN_ROOT = '/home/mpaccione/Projects/emsdk/upstream'
EMSCRIPTEN_ROOT = '/home/mpaccione/Projects/emsdk/upstream/emscripten'
NODE_JS = '/home/mpaccione/Projects/emsdk/node/12.9.1_64bit/bin/node'
TEMP_DIR = '/tmp'
COMPILER_ENGINE = NODE_JS
JS_ENGINES = [NODE_JS]
If I am in /var/www/html/collision-detection-wasm/hello-world
... command 'emcc' not found.
I followed the install instructions but they did not work how I would expect. I need this to work globally or it's not of use.
How do I go about doing that on Ubuntu Linux?
In order to use emcc it needs to be in your $PATH.
To do this you can run source /path/to/emsdk/emsdk_env.sh in your terminal.
Or if you want to make it permanent you can add that same command to your startup scripts (e.g. $HOME/.bash_profile or $HOME/.bashrc).
This is documented at https://emscripten.org/docs/getting_started/downloads.html.
Hijacking #sbc100's answer to further clarify things to answer OP's question asked as a comment.
In order to use emcc one needs to set the PATH and other environment variables.
As it can be seen in the documentation, the command source ./emsdk_env.sh (or source /path/to/emsdk/emsdk_env.sh if you are not within the emsdk directory) does exactly that for the current terminal.
If you want this effect to be permanent, then do just as #sbc100's said. Just add it to, for example, to your bashrc file by inserting source /path/to/emsdk/emsdk_env.sh to a new line at the end. This will make the script run each time a terminal opens. This may be annoying to same as it outputs what was added to PATH and which environment variables were set.
Alternatively, one may also add the entries to the bashrc manually that the script kindly tells us about. For me, it meant inserting the following lines:
## Emscripten ########
export PATH="/home/dudly01/repos/github/emsdk:$PATH"
export PATH="/home/dudly01/repos/github/emsdk/upstream/emscripten:$PATH"
export PATH="/home/dudly01/repos/github/emsdk/node/14.18.2_64bit/bin:$PATH"
export EMSDK="/home/dudly01/repos/github/emsdk"
export EM_CONFIG="/home/dudly01/repos/github/emsdk/.emscripten"
export EMSDK_NODE="/home/dudly01/repos/github/emsdk/node/14.18.2_64bit/bin/node"
I would think, however, that these lines need to be adjusted as the project evolves.

zsh option to generate the recomended options

There is a nice option when setting up zsh on Ubuntu
Populate your ~/.zshrc with the configuration recommended
by the system administrator and exit (you will need to edit
the file by hand, if so desired).
However, on a fresh Arch Linux install the option is missing. Is there a way to have it (or maybe, I am being picky here) ?
This happens when you haven't got a .zshrc and there's a /etc/zsh/recommended.zshrc. If you say yes, it'll just copy that one to .zshrc.
Arch, bare-bones awesomesauce that it is, doesn't bother to ship such a file.

How to set up Environment java variable in Ubuntu bash?

I am trying to set up Java in my new laptop. I have installed java jdk and I am trying to set up the environment variable now, But I am really confused between the file .bash_profile, .bashrc, .profile. I understand the concept behind login and non login shells, but when I wrote the JAVA_HOME, PATH variable in .bash_profile I needed to manually run the command
. .bash_profile
It did not get executed at the start when I restarted the computer to make it run as .bash_profile is supposed to be called by login shells. Can anyone explain to me what is the reason behind .bash_profile not being called up?
Since .bash_profile was not being called, I decide to type the PATH, JAVA_HOME variable to the file .bashrc, While this is working is this the right way to set up environment variables?

How to teach R find the texlive directory when using rstudio?

My operating system is linux mint 15, and I recently installed the texlive 2013. After installation, I appended the search path for texlive to ~/.bashrc
# set PATH
PATH=/usr/local/texlive/2013/bin/x86_64-linux:$PATH; export PATH
# set MANPATH
MANPATH=/usr/local/texlive/2013/texmf/doc/man:$MANPATH; export MANPATH
# set INFOPATH
INFOPATH=/usr/local/texlive/2013/texmf/doc/info:$INFOPATH; export INFOPATH
Then I could locate cmds such as pdflatex on xterm. However, when I wanted to use the pkg Sweave in rstudio, it always prompted that No Tex installation detected. I examined the $PATH in rstudio by Sys.getenv("PATH") and found out that the texlive/ directory was not appended to $PATH. So I guessed the problem was that the environment of Xsession doesn't take ~/.bashrc into considration. How to address this issue. Any help would be appreciated.
I have recently set up a configuration like yours.
The most correct solution is to put those lines into ~/.profile (or /etc/profile, for all users, as I did); this way all processes will inherit that PATH, not only those derived from bash.
You are right. R Studio runs in a shell that doesn't pay attention to the usual startup scripts. As far as I can tell, the appropriate place to change them globally (for all users) is R_HOME/etc/Renviron.site and for individual users, $HOME/.Renviron. (On my system, R_HOME is /usr/lib/R.)
Run ?Startup in the R Studio console for more details.

Installing TexLive 2010 in Ubuntu 10.10: problem with PATH

I'm followint these instructions to install Kile+TexLive 2010 with package manager on my Ubuntu Maverick: http://ubuntuforums.org/showthread.php?t=141934
The problem I have is that when I finish downloading all the packages to my computer, I have to edit the path but Ubuntu doesn't recognize it. The lines are the following:
PATH=/usr/local/texlive/2005/bin/i386-linux:$PATH
export PATH
I run echo $PATH and as long as I don't close the terminal, the path appears with the echoing, but if I close it, the path disappears. Nevertheless (whether I close the terminal or not), I'm supposed to run texhash but I am told that the command is not found. I already tried editing the path by adding the two lines above to both .bashrc in my home directory and to bash.bashrc in /etc/ directory.
I'm just following the instructions linked above, but I'm a linux rookie. Could anyone help, please?
in order to permanently change any environment variable under Ubuntu/Linux, you must modify the files you mentioned (for example ~/.profile). If you simply issue an export via the terminal, its effect will end once the terminal is closed. Sometime it is needed to perform a logout/login for the changes to take effect.
Also, mind the syntax of what you write in the above mentioned file(s), like "'s around $PATH.
Refer to this question: https://serverfault.com/questions/44275/how-to-add-a-directory-to-my-path-in-ubuntu

Resources