Questions tagged [bash]
The Unix shell formerly used by Terminal in macOS until 10.15
1,800
questions
3
votes
2
answers
400
views
what is DELUXE-USR-LOCAL-BIN-INSERT in ~/.profile file?
My .profile file includes the following obscure lines. What are they for?
##
# DELUXE-USR-LOCAL-BIN-INSERT
# (do not remove this comment)
##
3
votes
1
answer
2k
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 ...
3
votes
1
answer
690
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/...
3
votes
2
answers
432
views
Preventing Relocated Items shortcut after every update
The Problem
My Mac has received a new Relocated Items folder after every OS update since March 8th, 2020. This was around the time I upgraded to Big Sur I think. If I delete the shortcut, it'll just ...
3
votes
1
answer
2k
views
sudo: setrlimit(8): Invalid argument after switching Mac OS shell from BASH to ZSH
After updating to Mac OS Catalina some months ago, I followed the prompted suggestions and changed my shell from BASH to ZSH.
Since that time, whenever I use sudo in Terminal, I get sudo: setrlimit(8)...
3
votes
3
answers
6k
views
cron lacks permissions to run a script
I have a script (which backs up, using rclone) that I can run from the Terminal or Automator after chmod a+x, with no permissions problems.
However, when this script is run in cron (or launchd), ...
3
votes
2
answers
231
views
How to create recursive download and rename bash script
I need to make a bash script that will download a image with curl and then rename the file, wait 5 mins and then re-download the file and rename it again so that the new file does not replace the old ...
3
votes
1
answer
249
views
Bash script combine echo say and read
Using a bash script on Mac OS X, how do I combine echo, say and read to make it cleaner and less line of code? The below script works but to me there are too many lines. Thanks a lot for your help.
...
3
votes
1
answer
1k
views
How to find the PID(s) of a hung app in macOS from the shell (Terminal)?
Within Activity Monitor.app it's easy to visually identify a hung app by seeing its name in red text:
How can such hung app statuses be identified from the shell (Terminal.app) and the PID(s) of ...
3
votes
1
answer
421
views
What does “Cache location entry for Photos.app in cache file” error signify in Automator app?
I have written a very basic script to count the number of files in a folder, then if it reaches 16 files, to run an automator workflow, as below:
#!/bin/bash
cd /Users/barbooths/Projects/...
3
votes
1
answer
847
views
Bash script detect received iMessage along with its contents?
I've been doing some searching around online for an answer to this question and can't seem to find one. My aim is to run a bash script which waits for the arrival of an iMessage from a specific ...
3
votes
2
answers
2k
views
Automate package installation via shell script for macOS?
I am trying to write a shell script to automate installation of a bunch of dependencies for a project on macOS which will be an equivalent script for the same that works on EL6/EL7 and uses the yum ...
3
votes
2
answers
125
views
Seeking script to add to my automator service to make it reveal newly created item in finder
After much research (I am not familiar with Shell, Bash coding... and only just discovered the magic of Automator and Terminal usefulness), I've created an Automator service that captures a shot of ...
3
votes
1
answer
144
views
Search Bear notes using `grep` command
With grep, I can search through the content of all the files in a directory, for an instance:
grep 'program' *.md
searches for the pattern program within the content of all .md files in the current ...
3
votes
1
answer
296
views
How to parse output from diskutil activity in bash script
I want to be able to run a bash script over each line output from diskutil activity", I haven't been able to figure out how to do this though.
I thought maybe I could simply:
diskutil activity | ...
3
votes
1
answer
63
views
Checking if option is selected under System Preference on Mac
I have an issue with AD binding on Mac. Computer shows its already bind to AD but won't allow domain logins. What I noticed is "Allow network users to log in at login windows" option is grayed out. I ...
3
votes
2
answers
4k
views
Change background image through terminal on macOS Sierra
I though of a random python program to take a URL and download the photo, then making it the Desktop background. People have had success with this before, but as of the macOS Sierra update I've been ...
3
votes
1
answer
2k
views
Open an IPA file from the command line
I am using an OSX box to run a bash script to extract an iOS IPA file so that I can use otool and nm to extract details about the app for vulnerability analysis. The ipa files are already decrypted, ...
3
votes
1
answer
167
views
Recognise command and colour it on the terminal?
I was wondering if it's possible to colour a recognised command in real time while typing and/or when switching to previous commands using the arrows.
For example, if I start typing gre, it should ...
3
votes
2
answers
384
views
Have Apple announced whether the "Shellshock" bash update will be applied automatically via the App Store patching mechanism?
As described here, I'm technically vulnerable to the "Shellshock" bug in my shell. I'm running Mavericks.
Apple has released an update to bash that addresses this issue. As per the example test ...
3
votes
2
answers
1k
views
What's a way to run an automator/bash/applescript command right when a laptop starts charging and right when it stops being charged?
I'm trying to automate running a background application only when my laptop is charging to save battery.
So it will launch when I plug the laptop in, and quit when I take it out.
3
votes
1
answer
915
views
Auto-complete to multiple possible file extensions
(Edit: I suspect this was a better fit for the Unix and Linux stack exchange network -- could someone migrate this over there? Or do I have to make an account over there myself?)
I'm converting ...
3
votes
3
answers
2k
views
Does Mac OS X's bash read scripts for all users (tab-completion scripts) from /opt/local/etc/bash_completion.d path?
I stumbled upon some instructions in the book "Pro Git"
It suggests:
Download this file :
https://github.com/git/git/blob/master/contrib/completion/git-completion.bash
If you use the Bash shell, ...
3
votes
2
answers
576
views
Can't open a file in sublime text using bash_rc
My bash_profile function looks like:
function st() { /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /Users/ishan/workspace/nltk_engine/index.py;}
However, when I do st in terminal, ...
3
votes
1
answer
148
views
Log software usage time on Mac OS 9 (Oct. 1999)
I'm needing to log the time a user spends inside of an application in Mac OS 9. I created a simple bash script "launcher" to do this, but then discovered OS 9 doesn't have bash installed. Here is the ...
3
votes
1
answer
724
views
Running an AS droplet from Terminal
I have an Applescript Droplet application that I need to run from terminal. I can use osascript or even just open to open the AS App, but that will run its on run handler, not the on open droplet ...
3
votes
1
answer
797
views
How do I verify the integrity of my OSX installation? (Files, versions, and preferences)
I want to verify the files, and configuration settings for my OSX installation against a known good reference "base".
Assuming I have two identical Macs (hardware), with one being factory installed ...
3
votes
1
answer
1k
views
Copy contents of a smart folder to a new folder in Mountain Lion
I admit that my music collection is a royal mess. This is the result of merging many sources of music (external drive, old iPod sync, iTunes purchases, etc) into my iTunes account. iTunes Match has ...
3
votes
0
answers
65
views
Shell script hangs when run with a shebang line
This didn't used to happen, but now when I try to execute a shell script in my path by name, it just hangs.
The script: ~/bin/foo:
#!/bin/sh
echo this is foo
My PATH:
/usr/bin:/bin
What happens ...
3
votes
2
answers
8k
views
How to launch docker container from CLI in MacOS (eg `docker run ...`)?
How can I launch a docker container from the command-line in MacOS?
In Debian Linux, I can execute the following commands to install docker, launch a new docker container based on the latest version ...
3
votes
0
answers
778
views
What path is needed to run homebrew cask installed apps from the command line?
I installed Thunderbird using homebrew cask. I am using Intel Processor.
/Applications/Thunderbird.app/Contents/MacOS/thunderbird -whatever
How can I use the command line options of thunderbird on ...
3
votes
0
answers
42
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" ...
3
votes
0
answers
218
views
Garbled Terminal output
The text displayed and the cursor on Terminal is very often garbled or 'noisy', and this is across releases for as long as I can remember. That said, it seems worse on Big Sur.
Symptoms:
Suppose I've ...
3
votes
0
answers
2k
views
Add Finder Sidebar Section via Terminal
Is it possible to add a new section to the Finder sidebar?
I'm interested in adding a new section to the Finder sidebar, and auto-populating it as part of some personal automation.
I understand that ...
3
votes
1
answer
792
views
Path into PS1 prompt is broken (\n) on different lines when it is too long
I am using iTerm2 on MacOS Catalina . Here is my PS1 into ~/.bashrc , using a function ps1 :
function ps1 {
# PROMPT SECTION
BLUE='\[\033[0;34m\]'
LIGHT_CYAN='\[\033[1;36m\]'
...
3
votes
0
answers
3k
views
Where is system default environment variable set in MAC OS? [duplicate]
I am using macOS High Sierra V10.13.6. I can set up my custom environment variables in .bash_profile. But where is the system default environment variables are stored in the mac system
For Ex:
If i ...
3
votes
0
answers
149
views
How can I detect which button was clicked in the DMG EULA confirmation screen
I'm using the open command to automate (via bash) opening a dmg which has a EULA attached to it. When I run open my_app_distribution.dmg I get a screen that looks like this:
The open commands uses ...
3
votes
0
answers
3k
views
How can I mount Google Drive File Stream before launchd user agents start?
I have a simple backup bash script that dumps the output of pg_dump for a PostgreSQL database into a Google Drive File Stream directory.
This bash script is referenced by a launchd user agent.
The ...
3
votes
0
answers
91
views
Where do I find what's all affecting my $PATH?
When I echo $PATH I get:
/Library/Frameworks/Python.framework/Versions/3.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/arukaj/Library/Android/sdk/platform-tools/:/Applications/XAMPP/...
3
votes
0
answers
2k
views
macOS new logging api (unified logging) log stream
Questions:
1) How can we redirect the log stream from stdin to, for example lnav? Currently, I use bash | (pipe), but I would like to hear if there is a better way to do it - the pipe buffer flow is ...
3
votes
0
answers
188
views
open -g command still opens application in the foreground
When I run the command open -ga /Applications/Google_Chrome.app http://example.com the application behaves normally and opens the url in Chrome without bringing the application to the foreground.
But ...
3
votes
0
answers
38
views
could .bash_profile, in theory, be slammed into the iCloud Drive and symlinked? [duplicate]
could .bash_profile in theory be slammed onto iCloud Drive and symlinked from there? I'd love to use the same .bash_profile on every computar.
Why this isn't the same as Dropbox - this, if answered, ...
3
votes
0
answers
900
views
How to make files safe so users can download and OS will not quarantine them?
I work with Axure software that generates dynamic and navigable prototypes in HTML. Once they are done I need to send a ZIP file of those HTML files to clients via e-mail or any download internal ...
3
votes
1
answer
434
views
how to run alias using bash -c from IDEA
I'm trying to run a program defined in an alias (and the alias is defined in a source file)
alias myapp="/somepath/app -arg1 -arg2"
Then I go to IDEA and create an External Tool
Program: Bash
...
3
votes
1
answer
2k
views
How to share .bash_profile between different users in the same group? [duplicate]
I have searched by google but cannot find a right solution.The scenario is like this: in my mac, there are two users, lets say user1, user2. these two users are in the same group, which is staff ...
2
votes
3
answers
1k
views
How do I stop word splitting in bash for loop?
When I run the command below:
mdfind -name iMazing
I get the following output:
/Users/apple/Library/Application Support/MobileSync/Backup/iMazing.Versions
/Users/apple/Library/Application Support/com....
2
votes
3
answers
989
views
General commands for getting help and/or documentation for command line utilities in terminal on macOS?
Some command line interfaces or command line utilities give some comprehensive documentation or help when --help is appended to the name of the command, for example git:
git --help
# shows ...
2
votes
1
answer
2k
views
Why won't wget work with cron?
I've been using the bashpodder script recently, and while the script works beautifully when I use it in the command line, the crontab I created for it doesn't work at all. It fails when it has to use ...
2
votes
2
answers
453
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 ...
2
votes
1
answer
400
views
Long command in terminal.app cause a bug
If I am in the last line of Terminal.app and enter a long command, it does not create new line, but instead overwrites the same line.
How can I solve this bug?