Questions tagged [bash]

The Unix shell formerly used by Terminal in macOS until 10.15

Filter by
Sorted by
Tagged with
1 vote
0 answers
36 views

Why is LANG environment variable wrong in shell?

When I start a Terminal (in Monterey 12.2.1) my LANG is sv_SE.UTF-8, which is fine. When I start a shell, or any other sub-process that reads environment, from GUI Emacs it is set to LANG="en_SE....
user avatar
  • 141
4 votes
1 answer
939 views

Terminal ls command does not list complete contents of /Applications

In Terminal.app, I issue the following commands: cd /Applications ls It lists many, but not all, of the apps that the Finder sees. The ones it appears to omit are all Apple, but it doesn't omit all ...
user avatar
  • 1,080
0 votes
0 answers
33 views

How to batch update finder tags, date created, and date modified on copied files based on original/reference files

I'm trying to update finder tags, date created, and date modified on files that were incorrectly copied to a new server, stripping all of these attributes. I still have access to the original server ...
user avatar
4 votes
2 answers
770 views

How do I debug zsh when startup performance is slow?

I'm using Z shell inside iTerm2 every time I open up a new window or a new tab it takes around 8 - 9 seconds to load. I found some information on how to debug zsh. I came across this Speeding Up My ...
user avatar
0 votes
1 answer
102 views

In iTerm how can I close a shell session when the running command finishes?

I open some iTerm2 sessions via ttab. I start these session for textual UI commands like top or commands which might run for a long time like cp -r <large-dir> <backup-location>. After the ...
user avatar
  • 1,210
2 votes
1 answer
117 views

Change creation date to folder name - batch

Hi I have a load of jpg and avi files in sub folders which are named with the date the files were created. Unfortunately the files themselves have incorrect creation dates which I would like to batch ...
user avatar
0 votes
2 answers
232 views

how to change extended attributes on mac recovery

xattr worked on mac desktop system but I want to let it work in mac recovery terminal but xattr is not included in bash of terminal I copy xattr to usb drive and run it on recovery terminal ,but it ...
user avatar
9 votes
2 answers
1k views

Updating just Safari through terminal on Big Sur

There is a new version of Safari and I'm trying to update just Safari on my machine using a terminal command. I have Big Sur 11.6.3. I've done Softwareupdate -l and I see the Safari update there. I ...
user avatar
  • 171
1 vote
1 answer
55 views

Defined bash commands not found when passed in "do shell script" in osascript

I am new to shell script and recently wrote a script to open a new terminal window and run defined functions via osascript with "do shell script", but the result showed the command not found....
user avatar
  • 13
1 vote
1 answer
68 views

Prepend folder names to file name

I'm trying to add the folder name to the names of the files contained in the folders and sub-folders. @nohillside has already provided a command which solves partly this problem; see Prepend folder ...
user avatar
  • 11
1 vote
1 answer
194 views

update/upgrade bash without homebrew

I have MacOS El Capitan - about bash it is: bash --version ... version: 3.2.57(1)-release ... I did realise the mapfile command is not available in that bash release. I already did do research and ...
user avatar
0 votes
1 answer
29 views

I'd like to change the shell script instruction to the one available in the terminal

do shell script "bless -mount /Volumes/BOOTCAMP/ -legacy -setBoot -nextonly" password "0000" with administrator privileges tell application "System Events" restart ...
user avatar
0 votes
1 answer
26 views

'grep --color' only shows limited number of matches and duplicates input lines

I have a lengthy string on one line and want to highlight all occurrences of a character/substring using grep --color on the command-line. However, this only highlights matches in 'chunks' of 32. If ...
user avatar
  • 3
0 votes
1 answer
115 views

Alternative for getent to launch containerized ShinyProxy with a docker engine

I'm following this tutorial to launch a containerized ShinyProxy with a docker enine. It works as expected, until there is this getent command that seems to be unavailable for MacOS :( sudo docker run ...
user avatar
0 votes
0 answers
34 views

Bring PID's window into focus from Bash script

I'm writing a little script to run when a Windows/Wine-turned-macOS(using-Automator) app is opened. To keep it light, the app does not bundle Wine, instead the script checks if it's (Wine) installed ...
user avatar
  • 173
0 votes
3 answers
765 views

macOS doesn't run executable file anymore, after upgrade to Catalina/Monterey

Since I upgraded to Monterey (from Mojave), I cannot run anymore a local server that was installed under /Applications. The app has no extension, the file type is "Unix Executable File". It ...
user avatar
1 vote
2 answers
804 views

How do I get env variables to load on terminal startup? [duplicate]

It should be noted that I am on MacOS 12.0.1 and I'm looking to add some persistent environment variables. I have seen posts about creating and adding to ~/.bashrc or ~/.bash_profile but I'm not sure ...
user avatar
1 vote
1 answer
706 views

MacOS: How to delete network services from command line?

I have several dozens of non-existent network services that appear in the network panel in System Preferences. I have generated a list of network services with: networksetup -listallnetworkservices ##...
user avatar
  • 2,236
5 votes
1 answer
521 views

Tail terminal command is extremely slow when processing files with long lines

The tail command has become unusably slow for large files (e.g. 1 GB text file). EXAMPLE: $ tail -265000 file.txt > last_265000.txt takes 10+ minutes, whereas $ head -265000 file.txt > ...
user avatar
  • 161
2 votes
1 answer
863 views

zsh does not find script in PATH while bash does (echo $PATH is the same)

I am trying to execute a script using just its name. So naturally I added it to the PATH variable. But it seems zsh does not care. If I switch to bash everything works fine. The following terminal ...
user avatar
  • 245
3 votes
1 answer
154 views

under macos 10.15.7, why cannot cron find files on my external hard drive? [duplicate]

I purchased an external hard drive for scheduled backups of my macbook pro, presumably under cron. My rsync commands work fine when I invoke on the bash (interactive) command line. But as soon as I ...
user avatar
0 votes
1 answer
162 views

Set Screensaver Programatically

I have searched for this, but can only find (old) fragments of information.. and nothing especially concrete for Big Sur or Monterey about how to set the screen saver through a script (bash most ...
user avatar
  • 129
3 votes
2 answers
2k views

Convert PS1 prompt from bash to zsh for colour customisation

The macOS Monterey system uses zsh shell instead of bash, and I want to convert this bash command which you'd normally store in a .bash_profile file export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[...
user avatar
  • 61
1 vote
2 answers
494 views

Is there an alternative to whiptail for macOS?

I would like to try out a shell script that makes use of whiptail, but I am on a MAC and whiptail doesn't seem to exist there. Does anyone know if there exists a drop-in alternative (like, for example ...
user avatar
  • 121
9 votes
4 answers
3k views

Mac terminal found open with “man James” text. Have I been hacked?

I found a terminal window open with the below. I ran /bin/bash -x and it looks like VMware was accessed and GPG tools. It also added something suspicious to my login items... have I been hacked?! Also ...
user avatar
1 vote
1 answer
144 views

How to delete line 7 in a file in Bash with sed?

How to delete line 7 in a file in Bash? I tried $ sed -i '7d' ~/demo error:sed: 1: "~/demo": command a expects \ followed by text
user avatar
  • 21
3 votes
1 answer
862 views

permission denied to add current directory to path

I am trying to install NGC CLI on company's Mac following the instructions given here. https://ngc.nvidia.com/setup/installers/cli When I try to run the third command there, which is echo "export ...
user avatar
4 votes
1 answer
211 views

Programs don't show up in jobs if I start them in the background with a shell script

I want to launch a three programs (2x streamlit, 1x python) in the background with a shell script: #!/bin/sh cd /Users/mc/src/crypto/ || exit streamlit run dashboard.py & streamlit run ...
user avatar
  • 143
0 votes
0 answers
85 views

Using osascript to get the file currently edited in Xcode

I'd like to write osascript that fetch the full path of the file currently being edited in Xcode. I've tried the following code, which works most of the times. However, if I just modified the file ...
user avatar
  • 493
0 votes
0 answers
47 views

osascript : automate several clicks in Xcode application doesn't work

I'd like to run ocascript from bash that goto my Xcode application and perform the following steps : click the Select All button under Edit menu. click the Paste button under Edit menu (this will ...
user avatar
  • 493
1 vote
1 answer
107 views

Why `read -N` doesn't work in this script on mac terminal?

could anyone please advise me how to fix this for a terminal in macos? Thank you for your help. read -s -N1 -p "Press a key: " K1="$REPLY" read -s -N2 -t 0.001 K2="$REPLY&...
user avatar
  • 21
0 votes
0 answers
56 views

Bash terminal error setlocale:LC_COLLATE

i installed mac ports bash and when i set my default terminal to mac ports bash and when i restart i get an error. I also get this error when i installed bash with brew. how can i fix this issue? -...
user avatar
0 votes
1 answer
48 views

Why are spaces being converted to question marks in this script?

I'm attempting to modify a bash script someone else wrote, and while it's off to an okay start, I'm running into issues. For any files that contain a space, the spaces are being converted to question ...
user avatar
  • 21
0 votes
1 answer
355 views

How to check if permissions for /usr/local, /usr/local/bin, /usr/share/man/man1 have been altered, and how to restore them?

Following this answer https://superuser.com/a/1025007/642458 I tried to install tree from source. Running make install the first time, I got this output: ...$ make install install -d /usr/local/bin ...
user avatar
  • 397
2 votes
2 answers
1k views

What is xcrun and why would updating to macOS Mojave cause it to go missing?

I just upgraded my (Intel based) MacBookPro to macOS Mojave and now when typing git pull in a (Bash) shell, I now get the message: xcrun: error invalid active developer path (/Library/Developer/...
user avatar
1 vote
1 answer
49 views

What is the Bash DEFAULTS "domain" for changing [accessibility > display > colour Filters > tint]?

I want to write some bash-scripts that change for me system settings like: accessibility > display > colour Filters > tint What's in general the best way to find that "domain" (...
user avatar
3 votes
1 answer
448 views

sqlcmd cannot find odbc 17 on MacOS Big Sur

I installed MSSQL per directions here. /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" brew tap microsoft/mssql-release https://github.com/...
user avatar
  • 160
0 votes
0 answers
47 views

Where is the starting path set for apps created with Automator?

So, twenty years later I tried to adopt Launchpad one more time, failed, but it got me to start creating Automator apps from Wine apps or Java applets. On the resulting app, I open it to move the ...
user avatar
  • 173
3 votes
0 answers
479 views

Catalina and pyenv install python versions fine, but anything needing ssl fails

I seek to use pyenv instead of manually installing an official python release. My goal is to run the included script titled “Install Certificates.command”. My assessment of the situation is pyenv is ...
user avatar
0 votes
0 answers
8 views

How to open multiple terminal tabs in same window via apple script or bash [duplicate]

I am trying to open 4 terminal tabs in one new window, script I am using : if application "Terminal" is running then tell application "Terminal" # do script without ...
user avatar
1 vote
1 answer
237 views

zsh command substitution fails when assigned to LINES

Why does this fail for zsh? bash-3.2$ FILENAME="/Users/john/Desktop/hash.txt" bash-3.2$ LINES=$(cat $FILENAME) bash-3.2$ echo $LINES ccf09b34dd38f383ce0eb37efbda0bfc546bb562 ...
user avatar
  • 737
5 votes
2 answers
337 views

Can I trigger a Shortcut from bash in macOS Monterey?

Specifically, I want to be able to control Focus programmatically, I thought I could trigger it via a Shortcut but can't find anything.
user avatar
  • 151
3 votes
0 answers
39 views

Bash language is incorrect [duplicate]

I'm using Bash 5.1.8 from MacPorts as my shell. For some reason Bash is part French and I can't figure out why. Launching Terminal.app with "Set locale environment variables on startup" ...
user avatar
  • 865
0 votes
1 answer
214 views

Equivalent of xdotool script to open lots of terminal tabs and do actions, on macbook

I'm just migrated to macbook from ubuntu, for development. I had a bash script in ubuntu which opened lots of terminal tabs, and entered various commands in each one, like going to a particular folder,...
user avatar
4 votes
1 answer
406 views

launchctl: Unrecognized target specifier

I think that at one point in the past I disabled my media keys using the instructions provided in this answer. I am trying to re-enable them, but upon using the command: launchctl bootstrap "gui/$...
user avatar
2 votes
2 answers
2k views

upgrade bash on M1 but cannot change to the new bash

I installed new bash via brew brew install bash which bash # /opt/homebrew/bin/bash chsh -s /opt/homebrew/bin/bash I have added /opt/homebrew/bin/bash to /etc/shells $ bash --version GNU bash, ...
user avatar
7 votes
1 answer
3k views

Apple Silicon: /usr/bin/mandoc: Bad CPU type in executable

I recently upgraded from an Intel Mac to an Apple Silicon Mac. When running man ssh then hitting Q in Terminal it throws the following error: sh: /usr/bin/mandoc: Bad CPU type in executable My guess ...
user avatar
1 vote
2 answers
8k views

npm command not found in zsh but found in bash

I installed npm with nvm and the first time it went all great, now I tried to check npm version on Mac terminal an it shows: % npm --version zsh: command not found: npm But using VSCode terminal with ...
user avatar
  • 13
4 votes
1 answer
9k views

zsh: permission denied when Terminal has Full Disk Access

I regularly use shell files to execute tasks on my Mac quicker. I just upgraded to MacOS Monterey today, and since then, any shell files I have created, will not execute. Every time I double click on ...
user avatar
0 votes
1 answer
58 views

"which" command returns paths with two consecutive slashes

On my macOS machine, I noticed that sometimes the which command returns paths with two consecutive slashes. For example: bash-3.2$ which gcc /usr/local/bin//gcc bash-3.2$ which qr /Users/flyingblu/bin/...
user avatar

1
2
3 4 5
34