Questions tagged [bash]

The Unix shell formerly used by Terminal in macOS until 10.15

Filter by
Sorted by
Tagged with
0
votes
1answer
39 views

Terminal command ls/cd not opening external usb drive

I have a usb drive that I can access via Finder and rStudio but I cannot open the drive via Terminal to analyze its contents. I can see the usb drive name when I enter cd /Volumes && ls but ...
0
votes
0answers
22 views

Error when trying to open PNG file with Preview from command line

I use a bash script to generate a PNG file. At the end the script opens the PNG file, but occasionally I get the following strange error message LSOpenURLsWithRole() failed with error -600 for the ...
0
votes
1answer
27 views

How to make an Apple Script use its local directory?

I am trying to bundle a .jar executable into an application using the solution provided here: How to create a .app folder from an executable .jar?. I deduced that main.script inside Contents -> ...
1
vote
1answer
25 views

How do you open a specific folder in Finder without applescript?

Background I've replaced Finder as the default folder-opening app by editing ~/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist: <snip> { ...
1
vote
1answer
66 views

Make a sound in zsh when a command is not found

How can I get zsh to play a sound when the command is not found? Ex: I have the alias vpn to open my VPN from the terminal (zsh). If sometimes by mistake I type cpn instead of vpn, I get the following ...
0
votes
1answer
39 views

Terminal can't execute files In CWD

I stated having this behaviour recently when I tried executing my sh script via sh my_script.sh. It was a simple script with some pyinstaller command. Now, the issue that I'm having is that my ...
0
votes
0answers
28 views

How to run Applescript via bash from JAMF?

this apple script code works fine from the Script Editor app: tell application "Finder" to delete ((POSIX file "/Applications/Symantec Solutions/Symantec Endpoint Protection.app") ...
2
votes
1answer
41 views

What is the actual difference between sh and bash?

Based on what I've read online, sh is essentially an alias for bash; running a shellscript with sh will behave the same as if it's run with bash. In my experience this is not entirely true, as ...
1
vote
0answers
39 views

Multiple Desktops/Spaces: Assign specific application windows to a specific Space programmatically?

I have seen existing questions (Assign Application Windows to Different Spaces/Desktops, Spaces in Mavericks: apps do not remember their space, How to have certain *windows* start in different spaces ...
1
vote
1answer
23 views

LaunchAgents zip/tar not working in plist?

I created the plist for a 'custom' backup agent (via LaunchAgent). The (zip) program is called, but I keep getting a 'zip error: Nothing to do!' in my logs. I assume it has something todo with ...
0
votes
0answers
27 views

Using Packages to install and run homebrew

Using Packages to create an installer. The app depends on a package from brew. I added a install.sh to the pre-installation scripts section that has this: #!/bin/bash /bin/bash -c "$(curl -fsSL ...
1
vote
1answer
19 views

Empty output when using some shell commands via AppleScript's “do shell script”

AppleScript allows you to run shell commands with do shell script. It's easy to assign a variable to an output of such command. set theResult to do shell script "echo everything" >> ...
2
votes
1answer
585 views

Big Sur switched to zsh terminal but still uses .bash_profile

I've upgraded to Big Sur and noticed my user was still using bash shell, so I changed Users → Advanced Options → Login shell to /bin/zsh and restarted. The shell that starts appears to be zsh insofar ...
4
votes
1answer
57 views

Same file reappears on Relocate Items after each macOS update

The following file keeps reappearing after each macOS update: /Users/Shared/Relocated\ Items/Configuration/private/etc/shells.system_default Ages ago I modified the file /etc/shells to add the latest ...
0
votes
0answers
21 views

bash (and others) do not receive ^O [duplicate]

Under Terminal.app and iTerm2, the key combination ^O is not received by many terminal programs. For example, /bin/bash does not receive ^O. Indeed, if /bin/bash could receive ^O, then ^V^O would ...
1
vote
1answer
116 views

crontab Operation not permitted - cron has full disk access

I have seen here various issues about the crontab 'Operation not permitted' issue for Mac OS, but I seem to have a more complex situation on my hands. I have a bash file on the desktop, which I wanna ...
0
votes
0answers
15 views

How to allow accessibility permissions from command line [duplicate]

I can give accessibility permissions to some programs by going in System Preferences -> Security & Privacy -> Accessibility, and manually adding the programs one by one. Is there a way to do ...
1
vote
1answer
50 views

Adding Environment Variables

I can't understand the 3rd line in these instructions, found here Install dependency Ghostscript. On MacOSX: brew install ghostscript Create a symbolic link if you want to run it everywhere in bash ...
1
vote
0answers
25 views

How to automount an external drive to hold ~/LIbrary[/Developer[/CoreSimulator]]

Xcode simulators as usual multiples and expands turning ~/Library into a dumpster now on 256gb drive there is no space to install xcode 14.2 and i;m thinking to resolve the issue extensively buying an ...
2
votes
1answer
76 views

How can I script moving files up one directory level with Terminal (or BBEdit worksheet)

When exporting from Photos.app with settings that preserve the album & folder structure, every album folder contains dated folders for every date represented in that album, with the actual images ...
0
votes
1answer
64 views

How to create a script with Automator to watermark each PDF in a folder with a different watermark?

I am trying to create a script to watermark a group a PDF files in a folder, each PDF has to have a unique watermark. All the PDFs are in one folder, all the watermarks are in .png located in another ...
1
vote
1answer
54 views

Creating an alias for Python in bash/zsh

I have often seen people recommending to setup an alias in one's .bash_profile or .zshrc along the lines of alias python='python3' This seems like a convenient idea, however, as far as I understand, ...
-3
votes
2answers
74 views

How to get rid of phantom directories /Volumes on a Mac? [closed]

I have a couple of different problems with ls /Volumes. 1st, I have an AppleScript that could mount only 10 of my 13 volumes. The 3 I could not mount were named Data 1, Data 2, and Data 3. I renamed ...
2
votes
1answer
174 views

What is the exact equivalent of this netsh wlan add filter Windows command for Mac?

I want to block all networks from my PC with admin access and make it so that the user cannot reverse the changes. I will use admin access to only white list certain networks that will be visible to ...
1
vote
1answer
27 views

How should paths in /etc/paths.d get added to $PATH?

None of the paths I have in the /etc/paths.d directory are being added to $PATH in any of the shells on my High Sierra system. Presumably there’s supposed to be something in some file that says to ...
0
votes
0answers
20 views

How to run C# using Sublime Text3 build system on macOS?

I'm trying to run C# on Sublime Text 3 using a build-system config on macOS (with Command + B key combination). I've tried a few build systems: { "working_dir": "${folder:${...
1
vote
0answers
20 views

Centrify: install using script in macOS 10.15

We were used to install Centrify using a simple script launched from KACE: sudo /usr/sbin/installer -pkg CentrifyDC-5.5.2-x86_64.pkg -target / Starting from Catalina, it seems that the script ...
1
vote
0answers
30 views

How use 'expect' to runing 'openconnect VPN' in background?

I'm a newbie to write bash script,I was using macOS catalina, and I write a bash script which use expect to run openconnect, #!/usr/bin/expect ... spawn sudo openconnect --user xxx --protocol=...
0
votes
0answers
12 views

lesspipe stopped colorizing

Recently, lesspipe (installed through brew) stopped colorizing output. I'm not sure what changed to make it so, as the problem seems to be with the output of file, and both file and lesspipe.sh were ...
1
vote
2answers
47 views

Cronjob macOS does not work if set with a bash external script

I'm trying to create a new cronjob which launches a script every time at startup. If I do cronjob -e and then I insert for example @reboot bash /Users/user/script.sh and then I save everything is fine:...
1
vote
1answer
43 views

“__git_ps1: command not found” from running “/usr/bin/env bash”

When I run $ /usr/bin/env bash (but not otherwise) I get the error: __git_ps1: command not found I've tried updating ~/.git-prompt.sh and ~/git-completion.bash for the version of git that I'm using. I'...
2
votes
2answers
312 views

Using launchd to clear bash history?

Clarification: Am not looking to destroy history, am looking for means to periodically purge it via launchd for security purposes Have been using cat /dev/null > ~/.bash_history to clear bash ...
1
vote
1answer
27 views

Every time I start my terminal, I get “.zshrc:source:18: no such file or directory: /sourceme.sh”?

I've been trying to download some softwares. I've deleted those files, but now, I think my zsh file keeps wanting to source a file that's no longer there. Because of that, I get the following message ...
1
vote
1answer
45 views

Updated Bash via Homebrew (from 5.0.17 to 5.0.18). Now I get Error message after starting Terminal

Updated Bash via Homebrew (from 5.0.17 to 5.0.18). Now I get this Error message after starting Terminal: [Command not found: /usr/local/Cellar/bash/5.0.17/bin/bash] [Could not create a new process ...
0
votes
0answers
17 views

When I run a .command by double click, can I pass it its directory? [duplicate]

I have a bash script that I want to run when I double click it, so I've renamed my script.sh file to script.command. The script now gets executed when I double click it, but its working directory is ...
1
vote
0answers
19 views

Access text services via code

Is there a way to access text services such as these through either Applescript or terminal commands?
1
vote
0answers
81 views

Cannot install anything because of /usr/local/ permission

I'm using OS Catalina atm. I am trying to install Node and Homebrew but I can't seem to install anything because it keeps on saying I don't have permission in /usr/local/ Installing homebrew gives me ...
1
vote
1answer
100 views

How to return a list of all text editors via terminal?

Is there a way to return a list of all the installed text editors via the command line? I think (I can't test to confirm) this answer inadvertently gives the equivalent for ubuntu: sudo update-...
0
votes
0answers
90 views

Autochange TTL for Mac

I need to change TTL on my Mac, if I connect iPhone as a wi-fi modem. Now I am using this command: sudo sysctl -w net.inet.ip.ttl=65 Also I need to change TTL back to 64 when I connect to other wi-fi....
10
votes
6answers
2k views

Convert bash script to a compiled standalone binary executable, not text

I want to make a Bash script executable by the kernel. I have already used the chmod +x command and #!/bin/bash to make it executable and it works, but that I want to do is make it an executable ...
1
vote
1answer
50 views

How to switch the keyboard input language from the terminal?

I already have one way to do this: function input-switch-darwin() { cliclick kd:ctrl kp:space ku:ctrl } But this is very slow: ❯ time cliclick kd:ctrl kp:space ku:ctrl cliclick kd:ctrl kp:space ...
1
vote
2answers
74 views

Display Terminal message on login

I want to display something like ### this is a test ### when a new Terminal window is open (and ideally, in a way that can be disabled easily). On Linux this was straightforward; you'd create a script ...
1
vote
0answers
132 views

Install brew without prompt password

I want to create a script to automate the installation of brew on new workstations without entering password. In my /etc/sudoers I added the path to my file dsi ALL = (ALL) ALL dsi ALL = (root) ...
0
votes
1answer
76 views

Command line argument to “find” and “grep” data inside “xattr -l” atrributes?

I have a file that an application has set extended attributes for. $ xattr -l /Volumes/Educating\ Rita\ \(1983\)/Educating\ Rita\ \(1983\).1.eng.srt net.filebot.filename: 3_English.srt net.filebot....
1
vote
2answers
41 views

cron queueing bash and python scripts

I'm currently looking to understand and get comfortable with crontab queues on my macbook pro. I recently solved an issue where my simple bash script would not execute. It turns out I had to move my ...
0
votes
0answers
31 views

How to remap specific keys (insert, fn, etc.) usint hidutil

I have a computer that I cannot download much 3rd party software to (I'm not supposed to – long story, just accept it). This means, no Karabiner, etc. Further, the generic solution of "system ...
-1
votes
1answer
39 views

Duplicating and renaming images using script

I need to duplicate and rename an image using a list of SKU codes from a spreadsheet as the unique name for each image. I have used the script from this answer Automate Duplicating and Renaming Images....
1
vote
1answer
296 views

echo 'export PATH=“/usr/local/mysql/bin:$PATH”' >> ~/.bash_profile by using this command getting permission denied?

I tried to follow the instructions in How to add MySQL to $PATH variable to resolve "mysql: command not found"? $ echo 'export PATH="/usr/local/mysql/bin:$PATH"' >> ~/....
1
vote
1answer
25 views

Unable to run Bash 5 from launchd

I have the following launchd agent: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/...
2
votes
2answers
291 views

How can I convert this Bash prompt to zsh?

I have the following configuration for Bash: # Change Prompt # ------------------------------------------------------------ export PS1="...

1
2 3 4 5
31