0

I'm trying to change the directory that is accessed when I call blender in my terminal.

This is currently where it is:

...$ which blender
/usr/bin/blender

And I'd like to instead use the version of blender I have located in:

home/myname/tools/Blender-2.79-CellBlender/blender

I understand that similar questions have been asked, but I can't find anything that helps with my beginner level.

I'm using Debian 9.

...$ echo $PATH
/home/myname/tools/cmake/bin/:/<private>/home/myname/<private>/:/home/myname/tools/anaconda3/bin:/home/myname/tools/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

Question 1: Why don't I see the "/usr/bin/blender" path when I call echo $PATH?

Question 2: How do I permanently change the directory that's called when I type "blender" into the command line?


I've tried

export PATH=$PATH: ~/tools/Blender-2.79-CellBlender/blender

which works, but this doesn't help because:

  1. it doesn't permanently change the PATH, and

  2. since I already have "/usr/bin/blender" in the PATH (though I don't know how to see that!), it will always go to the first directory in the PATH, which isn't the one I want.

  • To make it permanent you need to add the line to .profile or .bashrc – guillermo chamorro Dec 10 '19 at 19:01
  • /usr/bin/blender is there because in $PATH is set /usr/bin – guillermo chamorro Dec 10 '19 at 19:03
  • Sorry, but could you elaborate what you mean by that? Where in .bashrc would I add the line, and what line are you referring to? Thanks! – Otherness Dec 10 '19 at 19:04
  • I've answered, hope it's clear, but I realize now that you are using debian, wich is off topic here in AU. So it's possible that this question is gonna be closed. You can ask again in U&L – guillermo chamorro Dec 10 '19 at 19:21
  • Okay, thanks for the answer and the heads up! – Otherness Dec 10 '19 at 19:32
3

Question 2: How do I permanently change the directory that's called when I type "blender" into the command line?

To add your path permanently you have to edit your ~/.bashrc(and you may have to log out/log in):

gedit ~/.bashrc

Add at the bottom:

export PATH="~/tools/Blender-2.79-CellBlender:$PATH"

As @bac0n explains in the comments, the order is important. As /usr/bin takes precedence if further configurations add the new path at the end of $PATH, the trick is to add the new path before /usr/bin (the order always left to right).

Question 1: Why don't I see the "/usr/bin/blender" path when I call echo $PATH?

You don't see blender because it's the executable file like are all the others under the path, being the path /usr/bin, which is set in you $PATH variable

  • I included the line you suggested at the bottom of .bashrc, but that doesn't seem to change anything. "which blender" still results in "/usr/bin/blender". Do I not have to first remove that path directory in order to have the other directory work? – Otherness Dec 10 '19 at 19:30
  • order of the paths is important.. – bac0n Dec 10 '19 at 19:39
  • Yes, I guess /usr/bin takes precedence. But remember, the path is not /usr/bin/blender, it's just /usr/bin, under wich are all the executables. – guillermo chamorro Dec 10 '19 at 19:39
  • @bac0n added your insight to the answer. – guillermo chamorro Dec 10 '19 at 19:47
  • 1
    I recommend defining and modifying environment variables in your ~/.profile and keep the shell rc for configuration options that are specific to that program. – jsb Dec 10 '19 at 19:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.