How to set PATH statements in Big Sur

I installed a trusted program that apple disabled several programs within. It appears I need to set the paths to the apps to make the software work. I likely need to do this in terminal. I have bothered the programmers enough. this is a serious scientific program.


would someone please explain to me the following command and how to modify it? This is for the successful path setting I did for the computational chemistry program ORCA. Now I need to apply it to the program NoSherA2 (crystallography, a part of OLEX2). Thank you


echo $PATH orca421

/Applications/orca:/Users/greg.rohde/Library/Orca421:/Users/greg.xxxxx/Library/orca_6_0_1:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin orca421


I am using Big Sur (I know it is old, it is school issued and I have many students with old computers too)



[Edited by Moderator]



MacBook Air 13″, macOS 11.6

Posted on Nov 29, 2024 5:25 PM

Reply
Question marked as Top-ranking reply

Posted on Dec 2, 2024 8:48 PM

Thanks for the clarification. Unfortunately I don't know anything about those programs. I would need to be provided some documentation for them in order to assist.


You must be extremely careful when using the command line since there are no safety nets. The commands you execute will do exactly what you tell them to do, although it may not be what you intended for them to do. The example commands you have provided in this thread all appear to be incorrect in some manner so I don't know what the exact command you used to fix ORCA since what you have posted here would not have done anything for ORCA. I think you have a few typographical errors in the commands you posted. And that is very dangerous when using & discussing the command line.


I'm assuming the "xattr" command was supposed to have a " -c " instead of an " -s "?


And the "echo" command maybe should have had an " >> " between "$PATH" and "orca421" perhaps in order to append the contents of the "$PATH" variable to the end of the "orca421" file which I'm assuming would be a configuration file?


There are several ways different apps & utilities may reference the $PATH variable. Plus certain apps may need to have the path variable modified. Whether you do this for the whole system/user or just for the individual app makes a difference as well. It is necessary to have some understanding of the apps/utilities you are using here and how they need to be provided with the $PATH variable since it seems you may be customizing the individual configuration files for them. Without the related documentation for these app/utilities you are trying to piece together, I'm not going to be able do much for you. At best, without any specific documentation, the easiest option would be to configure the $PATH variable for your shell to include all the relevant paths to each of these apps/utilities assuming those apps/utilities even reference the shell $PATH variable.


It would definitely help to know the exact contents of the $PATH variable configured for your current shell. You can use the following command:

echo  $PATH


Also, what shell are you currently using as that may also play a role here (that last character is the number zero):

echo  $0


Notice how I displayed the commands here? Whenever you post any command line commands or output of them, please use the "Code Insertion" tool whose icon on the forum editing toolbar looks like "</>". The Code Insertion tool used a fixed width font which makes it much easier to distinguish characters and spaces, and formatting of output. Note the zero has a backslash through it unlike the normal text of this window.


I highly recommend you review this tutorial on using the Terminal command line (there are six parts & relatively short):

https://scriptingosx.com/2017/07/first-steps-in-terminal/


Unfortunately most articles discussing the macOS command line are not very good, or they go into things that are not necessary or reference items/tools that are too difficult for a beginner. The linked Terminal primer is the best I could find that focuses on macOS. Most other articles out there are focused on Linux. While the very basic shell commands & utilities are very similar for both macOS & Linux, macOS uses an extremely old version of many of those commands & utilities so many of the Linux examples may not work on a Mac, plus many Linux tutorials will reference Linux specific items as well.


Before you do anything further with the command line, make sure you have a good backup first so if you accidentally mess things up, then you can restore from a backup. Trust me, you will make mistakes no matter how careful you are. If you are going to modify any file, then I highly recommend you make a copy of that file first since it can be difficult to remember what the original file contained (the "echo" command you used earlier I beliee was intended to modify a file). You should never use any commands that you do not understand. You may not fully understand a command, but you should at least have a good general idea what any command does that you are going to use (and the particular options you are giving it). If you review that Terminal primer I linked, then you will know how to use the "man" command to get more details on a particular command & its options/flags. Plus you can view the command history of the shell in order to provide the exact commands you used previously. Either using the Up arrow or the "history" command ("history" for the Bash shell, or "history 1" for Zsh ).


Hopefully another contributor will chime in here to assist and hopefully they may know something about the apps/utilities you are using.

5 replies
Question marked as Top-ranking reply

Dec 2, 2024 8:48 PM in response to Marshall_teacher

Thanks for the clarification. Unfortunately I don't know anything about those programs. I would need to be provided some documentation for them in order to assist.


You must be extremely careful when using the command line since there are no safety nets. The commands you execute will do exactly what you tell them to do, although it may not be what you intended for them to do. The example commands you have provided in this thread all appear to be incorrect in some manner so I don't know what the exact command you used to fix ORCA since what you have posted here would not have done anything for ORCA. I think you have a few typographical errors in the commands you posted. And that is very dangerous when using & discussing the command line.


I'm assuming the "xattr" command was supposed to have a " -c " instead of an " -s "?


And the "echo" command maybe should have had an " >> " between "$PATH" and "orca421" perhaps in order to append the contents of the "$PATH" variable to the end of the "orca421" file which I'm assuming would be a configuration file?


There are several ways different apps & utilities may reference the $PATH variable. Plus certain apps may need to have the path variable modified. Whether you do this for the whole system/user or just for the individual app makes a difference as well. It is necessary to have some understanding of the apps/utilities you are using here and how they need to be provided with the $PATH variable since it seems you may be customizing the individual configuration files for them. Without the related documentation for these app/utilities you are trying to piece together, I'm not going to be able do much for you. At best, without any specific documentation, the easiest option would be to configure the $PATH variable for your shell to include all the relevant paths to each of these apps/utilities assuming those apps/utilities even reference the shell $PATH variable.


It would definitely help to know the exact contents of the $PATH variable configured for your current shell. You can use the following command:

echo  $PATH


Also, what shell are you currently using as that may also play a role here (that last character is the number zero):

echo  $0


Notice how I displayed the commands here? Whenever you post any command line commands or output of them, please use the "Code Insertion" tool whose icon on the forum editing toolbar looks like "</>". The Code Insertion tool used a fixed width font which makes it much easier to distinguish characters and spaces, and formatting of output. Note the zero has a backslash through it unlike the normal text of this window.


I highly recommend you review this tutorial on using the Terminal command line (there are six parts & relatively short):

https://scriptingosx.com/2017/07/first-steps-in-terminal/


Unfortunately most articles discussing the macOS command line are not very good, or they go into things that are not necessary or reference items/tools that are too difficult for a beginner. The linked Terminal primer is the best I could find that focuses on macOS. Most other articles out there are focused on Linux. While the very basic shell commands & utilities are very similar for both macOS & Linux, macOS uses an extremely old version of many of those commands & utilities so many of the Linux examples may not work on a Mac, plus many Linux tutorials will reference Linux specific items as well.


Before you do anything further with the command line, make sure you have a good backup first so if you accidentally mess things up, then you can restore from a backup. Trust me, you will make mistakes no matter how careful you are. If you are going to modify any file, then I highly recommend you make a copy of that file first since it can be difficult to remember what the original file contained (the "echo" command you used earlier I beliee was intended to modify a file). You should never use any commands that you do not understand. You may not fully understand a command, but you should at least have a good general idea what any command does that you are going to use (and the particular options you are giving it). If you review that Terminal primer I linked, then you will know how to use the "man" command to get more details on a particular command & its options/flags. Plus you can view the command history of the shell in order to provide the exact commands you used previously. Either using the Up arrow or the "history" command ("history" for the Bash shell, or "history 1" for Zsh ).


Hopefully another contributor will chime in here to assist and hopefully they may know something about the apps/utilities you are using.

Dec 2, 2024 7:58 PM in response to Marshall_teacher

The echo command did not change your path. "echo" is a builtin that literally just "echoes" whatever comes after it back to the terminal - it's just that environment variables like $PATH are expanded and replaced with their value when echoed.


So "echo $PATH orca421" just copies $PATH - expanded - to the terminal prompt and then copies orca421. Which is why you have a space separating "/Applications/orca:/Users/greg.rohde/Library/Orca421:/Users/greg.rohde/Library/orca_6_0_1:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" and "orca421".


You set the $PATH variable using - as with all environmental variables - the "export" command. See, e.g., here: https://techpp.com/2021/09/08/set-path-variable-in-macos-guide/.


I caution you, however, that it doesn't seem like you really know what you are doing and should likely not be messing with environmental variables. There is absolutely no reason that any application that installs in /Applications would ever need to be in the $PATH. Nor should there be any executables you would need to call sitting in your home folder's Library - anything in there is meant to be called indirectly by programs (such as launch agents).


If you need to call some executable inside an obscure and marginally written program (I know very well how fragile academic software can be written) - you would be far better off writing your script to use absolute paths to the executable instead of adding random new paths to $PATH.


You should really talk to the developers of the programs you need and ensure you are using them correctly, for the sake of confidence in your results, if nothing else.


And please, if you can figure out what modified your PATH to append "/Applications/orca:/Users/greg.rohde/Library/Orca421:/Users/greg.rohde/Library/orca_6_0_1" to the front of it...please remove or reverse it if possible.

Dec 3, 2024 11:24 AM in response to Marshall_teacher

To help you, you need to provide us the directory where you installed the binaries

shelxt, shelxs, shelxl

.

Then you will have to put this path it at the end of your PATH variable.


For example, if you installed them in:

/Applications/Cristallographie/

then you will have to improve your PATH this way:

PATH=${PATH}:/Applications/Cristallographie
export PATH

Dec 2, 2024 1:34 PM in response to Marshall_teacher

It appears ORCA can only be downloaded only after receiving special permission from the developer so I cannot check it out or even see a download link to find out its macOS system requirements (I'm not sure the app still has a macOS version. Current version is 6.0.1 as of Nov. 5, 2024.



More than likely you are encountering two possible issues with running an older app on a later version of macOS.

  1. The version you have is not compatible at all with a later version of macOS
  2. The Privacy & Security System Preferences/Settings are not configured to allow the app to run.


For the second item, see if you have a confirmation button appear in the Privacy & Security section of System Preferences/Settings. This button will only appear for a short time after attempting to run the app. You can try launching the app by Right-Clicking or Control-Clicking on the app and selecting "Open". You should be presented with a pop-up prompt informing you the developer is not recognized & ask if wish to modify the system security settings to make an exception to allow this app to run anyway.

Open a Mac app from an unidentified developer - Apple Support


Keep in mind there is a possibility some inner command line utility within the ORCA app bundle may also need special permission/exception as well, but that would be more difficult if it is not granted an exception from the above instructions.


As for the first issue, you will need to contact the ORCA developers for assistance in downloading a newer version of the app.


Dec 2, 2024 2:44 PM in response to HWTech

Thank you for your reply. ORCA is my working example. I am sorry I was not clear. I used the terminal to write the PATH in the library file using a command. I was trying to do this for a new program (NoSpherA2 in addition to OLEX2). I used an echo command. I am trying to run a gui that runs one calculation in ORCA (successful) and then tries to open that output file with NoSpherA2 in the gui OLXE2. I need to adjust the Path in the library so OLEX2 can call on NoSpherA2.


I also used the command:

xattr -s com.apple.quarantine


on the entire directory for ORCA and OLEX2 to get my MAC to recognize those files as UNIX executable files. I was hoping you would teach me the format of the following command so I could apply it to the NoSherA2 path:


echo $PATH orca421

/Applications/orca:/Users/greg.rohde/Library/Orca421:/Users/greg.rohde/Library/orca_6_0_1:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin orca421


I want to run this program from both the GUI and the terminal prompt. It is not a permissions problem as stated in #2 above. In fact, there is no icon to click on. The output file of the parent GUI (olex2) says "file not found" so that tells me it is not an operating system problem, rather a path library setting problem.


I am sorry to repeat myself, but t the echo command above successfully changed my library path to get ORCA to work. I want to do the same for NoSpherA2.


Thanks you for your time

Greg

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to set PATH statements in Big Sur

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.