LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-15-2021, 11:24 AM   #1
blackbirdsr71
LQ Newbie
 
Registered: Jun 2015
Posts: 15

Rep: Reputation: Disabled
Can not set PATH permanently in order to launch MATLAB system wide


Hi to all,

I have the following issue:

I recently installed MATLAB R2018a in my artix linux (runit). I can launch matlab from the location where the launcher is, i.e.,
/usr/local/MATLAB/R2018a/bin, but if i try to launch it from another location i can't. So i tried to append the mentioned directory to PATH with different methods:

i) PATH=$PATH:/usr/local/MATLAB/R2018a/bin
export PATH

If i check with echo PATH it schows the directory, but after reboot the directory is not in PATH anymore.

ii) As the before method failed i edited ~/.bashrc:

export MATLAB_HOME=/usr/local/MATLAB/R2018a/bin
export PATH=$PATH:$MATLAB_HOME

then i source the file.
If i check with echo PATH it schows the directory, but after reboot the directory is not in PATH anymore.

iii) The last method failed too, so i edited ~/.config/shell/profile

the same result as before.

Can anybody tell what i am doing wrong? I am new to artix runit so maybe i made a big mistake. Thanks in advance!
 
Old 01-15-2021, 11:27 AM   #2
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
What's your login shell?
Code:
echo $SHELL
 
Old 01-15-2021, 12:57 PM   #3
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
You need to put that $PATH expansion into /etc/profile or ~/.bashrc so that it becomes active on boot or login rather than only when you manually do that from the cli.
 
1 members found this post helpful.
Old 01-18-2021, 09:17 AM   #4
blackbirdsr71
LQ Newbie
 
Registered: Jun 2015
Posts: 15

Original Poster
Rep: Reputation: Disabled
Thanks for your answer!

When i
Code:
echo $SHELL
i get

Code:
/bin/zsh
Finally i solved partially the issue with the help from artix forums. I created a script in /etc/profile.d/ where i put

Code:
export MATLAB_HOME=/usr/local/MATLAB/R2018a/bin

export PATH=$PATH:$MATLAB_HOME
and now i can launch matlab from terminal, but not from dmenu, where matlab appears but does not launch from there.What could be the issue in the last case?
 
Old 01-18-2021, 07:33 PM   #5
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
The system only processes /etc/profile when you open the terminal and get the shell environment.

You need a shell script for matlab that adds that to $PATH before it calls matlab directly.

On my system matlab is at /usr/local/bin/matlab so it could be renamed to /usr/local/bin/matlab.b and a script named /usr/local/bin/matlab could contain
Code:
export MATLAB_HOME=/usr/local/MATLAB/R2018a/bin
export PATH=$PATH:$MATLAB_HOME
/usr/local/bin/matlab.b
Thus the icon calling matlab would call the script which would set the variables before actually calling matlab.
 
Old 01-20-2021, 02:30 PM   #6
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
I am not aware what zsh uses, but on a bash based system the file ~/.bash_profile gets read at login so that equivalent could be used to set that path for your use with matlab and so not need to make the changes I gave above.

Duplicate the entry in ~/.bashrc or its equivalent so it is available for non-login use as well.

Last edited by computersavvy; 01-20-2021 at 02:32 PM.
 
Old 01-21-2021, 12:48 AM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by blackbirdsr71 View Post
and now i can launch matlab from terminal, but not from dmenu, where matlab appears but does not launch from there.What could be the issue in the last case?
I assume you mean dmenu_run?
In any case, it's possible that your PATH export is not (yet) applied globally.
That would require a) putting it in the appropriate file - one that's sourced at login - and b) log out/in.
 
Old 01-21-2021, 09:15 AM   #8
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,789

Rep: Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201
.zshrc is for zsh what .bashrc is for bash. They are run if an interactive non-login shell starts.

/etc/profile and its fragments in /etc/profile.d/ are common to zsh, bash, ksh, dash, ash, psh, sh, and to all users on the system.
They are run by login shells; some distros provide code to also run them by interactive non-login shells (and provide a flag variable that ensures they are run once).
 
Old 02-03-2021, 10:50 AM   #9
blackbirdsr71
LQ Newbie
 
Registered: Jun 2015
Posts: 15

Original Poster
Rep: Reputation: Disabled
Hi to all,

I found from matlab forums that in dmenu i have to write
Code:
matlab -desktop
in order to launch it from there. So i think that this post can be considered as solved. Thanks to all for your kind help.
 
Old 02-05-2021, 01:10 PM   #10
barunparichha
Member
 
Registered: Jun 2006
Location: Bangalore,india
Distribution: Linux(Redhat,fedora,suse,ubantu), Solaris (s8/s9/s10/nevada/open-solaris)
Posts: 303

Rep: Reputation: 32
You might change default shell to /bin/bash for your user-id inside /etc/passwd. After that .bashrc env parameters will be taken care by your shell(bash).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Logi Sales Manager on Ncurses (invoice, invoicing, orders, order, sale order, sales order...)? Xeratul Linux - Software 0 03-25-2017 02:45 PM
Matlab Distributed Computing Server: Connecting to Matlab client fails OEP Linux - Server 0 12-21-2009 02:18 PM
howto set system-wide environment variables permanently in debian vineet7kumar Linux - Newbie 2 05-08-2008 06:39 PM
How to set up an system wide environment variable permanently?? piyush.kansal Fedora 5 12-07-2007 04:04 AM
Terminal cmd for starting Matlab M-file editor without starting matlab fubzot Linux - Software 2 02-15-2005 06:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration