Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

GegeMartinelli

macrumors newbie
Original poster
Jan 24, 2026
3
1
Hello,

I have a MACBook Pro with Tahoe.
Both my MacBook and my NAS are on the same LAN, this LAN is isolated (no connection to the Internet, (for security)

I have developed a Java application to access all my Databases on the NAS
This used to work fine up to the Sonoma version. But fails since Sequoia.

To connect to my NAS , the Java program issues the mount smb command like the following :

SMB //user:password@192.168.1.21/SharedFolder ./LocalFolder
where 192.168.1.21 is the NAS IP address.

I have created an icon to start my java application from a BASH script, This always fails (but used to work).

Now if I open a Terminal session, and type "BASH script_name" it works fine.

That 's too much complicated for all users, so I want to make them click on the icon (like before).
I do guess there is a authorization needed for Java (because the NAS is local) , but I cannot solve my problem. I already spent days to try with no success.

Is there a way to do what I want?

Many thanks
 
Not sure what is going on here but this is what I would suggest.

Switch your script from using bash to using zsh. (Apple has long since switched to using zsh as the preferred shell for macOS. But, the script syntax is the same as bash in most cases, so you probably don't need to "anything" to "convert" your script.)

Make sure the first line in your script is:
Code:
#!/bin/zsh
This tells the CLI specifically which shell to run it in.

Make sure the script filename ends with ".command" (not ".sh"). macOS associates these files with the Terminal by default and I think that they don't even need execute permission to run (chmod +x).

Then double-click on the file from Finder, and it and it should just open in the Terminal and run, just as if you had typed it in the terminal.

———

Alternatively, you could just make a text file with this content:
Code:
#!/bin/zsh
bash script_name
...Name it with the extension ".command", and put it somewhere that your users can get to. It would be a "shortcut" saving them from actually having to open the terminal and type anything. (Obviously "script_name" is replaced with the actual name of your script.)
 
Not sure what is going on here but this is what I would suggest.

Switch your script from using bash to using zsh. (Apple has long since switched to using zsh as the preferred shell for macOS. But, the script syntax is the same as bash in most cases, so you probably don't need to "anything" to "convert" your script.)

Make sure the first line in your script is:
Code:
#!/bin/zsh
This tells the CLI specifically which shell to run it in.

Make sure the script filename ends with ".command" (not ".sh"). macOS associates these files with the Terminal by default and I think that they don't even need execute permission to run (chmod +x).

Then double-click on the file from Finder, and it and it should just open in the Terminal and run, just as if you had typed it in the terminal.

———

Alternatively, you could just make a text file with this content:
Code:
#!/bin/zsh
bash script_name
...Name it with the extension ".command", and put it somewhere that your users can get to. It would be a "shortcut" saving them from actually having to open the terminal and type anything. (Obviously "script_name" is replaced with the actual name of your script.)
Thanks a lot for your answer. I tried what you suggest and it works fine.
I just have a related question :


When I click on the xxx.command , my Java application starts correctly, however, the associated terminal panel also displays. Is there a way to hide it ? (like under Windows).

Thanks again. Have a nice day
 
Thanks a lot for your answer. I tried what you suggest and it works fine.
I just have a related question :


When I click on the xxx.command , my Java application starts correctly, however, the associated terminal panel also displays. Is there a way to hide it ? (like under Windows).

Thanks again. Have a nice day
I have answered myself to my last question, by changing a little the xxx.command as follow :

#!/bin/zsh
osascript -e 'tell application "Terminal" to set miniaturized of every window to true'
bash xxx.sh
 
  • Like
Reactions: PotentPeas
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.