Questions tagged [bash]

The Unix shell formerly used by Terminal in macOS until 10.15

130 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6
votes
0answers
203 views

Apple's online version function support-sp.apple.com/sp/product?edid= does not work for all macOS versions

I would like to get the Apple marketing name, the code name, for a given version of macOS (e.g. 10.12 is macOS Sierra) from Apple's online service at support-sp.apple.com/sp/product?edid=. This is ...
4
votes
0answers
138 views

iOS Cannot SIGINT or Ctrl+C when SSH'ed into it

I have a jailbroken iPhone that I often SSH into. For some reason, I am unable to Ctrl+C a foreground process or kill -INT a background process when said process is started in an SSH session, but I ...
4
votes
0answers
1k views

iotop on High Sierra

I seem to have issues with iotop on High Sierra, googling it I find no useful information. The output is garbled and almost unusable. I have SIP disabled for dtrace (I know "I'm not suppose to do ...
4
votes
0answers
59 views

Is there a way to run a bash script everytime I print something?

I wanted to run a script that changes my background image whenever use the printer. Is it possible? Is there a way to know when OS X is printing something?
4
votes
0answers
2k views

How to use nohup/send process to background on os/x

The command nohup <command> & does not actually work properly on mac it seems: the process is suspended. Issuing fg appears to be required to reactivate the command. Here is an ...
4
votes
1answer
523 views

How to schedule run of .command file (bash)?

I have a bash script (saved as myfilename.command) and would like to schedule its run. I've tried to use Calendar event for this (which works fine with Automator scripts), but I get the following ...
4
votes
1answer
1k views

Set file metadata attribute values

I'm trying to set the values of some file metadata attributes in OS X Yosemite - kMDItemDateAdded and kMDItemLastUsedDate - the values of which can be shown using mdls <filename>. I'm trying to ...
3
votes
0answers
65 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
0answers
357 views

Change keyboard layout automatically when external keyboard connected

I recently purchased an external keyboard (non-apple) that is used at home and also dragged along with me from time to time, and I've noticed a need. My Mac is in English, as well as its physical ...
3
votes
0answers
394 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
0answers
2k 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
0answers
599 views

Opening new Firefox window from command line while it's already running

Does anyone know how to open a new Firefox window from the command line while Firefox is already running? I can't find any solutions currently out there that work for me. I've looked at the MDN web ...
3
votes
0answers
3k views

Terminal (bash) - copy files from Windows (SMB) shares without mounting

In past OSX versions, one could copy files from SMB shares like so: smbclient //my-server/foo -U USER%PASS -I 127.0.0.1 -c "get my.file" However, in recent versions, sbmclient has been replaced ...
2
votes
0answers
30 views

Is it possible to add background music (with or without video) to the login screen on a Mac?

I've never seen this question asked before, and provided that Terminal exists I don't see why this wouldn't be possible. Does anyone know whether this is, or how they would make this possible?
2
votes
0answers
89 views

Run a command without opening the terminal

Is it possible to start a terminal command without opening the terminal first? I have some quick commands, and for those I open the terminal window, run the command, and close it again. I generally ...
2
votes
0answers
76 views

macOS Terminal not using correct manpath

How to set $MANPATH or manpath for the macOS Terminal Help menu command: Open man Page for Selection? Having recently done a clean install of macOS Mojave (10.14.6), I am trying to get my macOS ...
2
votes
0answers
28 views

Opening terminal from command line, starting bash and got to the same location where the original terminal was

For example, I have a terminal (running /bin/bash) opened at a certain folder. Now what I want is when I type trm on the terminal, it will open another terminal at the same location where the first ...
2
votes
0answers
101 views

Mac Terminal Slow after upgrading to PHP7.3

I had my Mid 2013 macbook air running Mojave (10.14.5) with PHP 7.1.23 updated to PHP 7.3 from https://php-osx.liip.ch/ using the command curl -s https://php-osx.liip.ch/install.sh | bash -s 7.3 . ...
2
votes
0answers
575 views

Create User via Terminal with Bash in macOS Mojave

In general, you can create a user via Terminal in macOS using Apple's documented method. However, macOS Mojave introduced various security mechanisms that cause scripts to fail when changing user ...
2
votes
0answers
250 views

Bash autocomplete in Terminal stops working after a while

Bash allows auto-completion using the tab key: If you type cd ~/D on Terminal, followed by the Tab key, you ear a beep, but if you follow by a second Tab key, the Terminal display the suggestions ...
2
votes
0answers
99 views

What are .backup files and how do I remove them?

I'm working on removing hidden files from a directory, but keep running into issues with .backup files. I keep getting permission denied notifications even when using sudo. I'm not sure where they ...
2
votes
0answers
22 views

Processes display not allowing page down

The display hangs on one page after I invoke process through command top, Press 'space', 'arrow' take no effects. I got recommend to use htop, but find it complicated to manipulate. How to page top ...
2
votes
0answers
75 views

path difference on script vs in shell

Why is the output of $PATH different when in a script vs when running $PATH from the terminal? Even for a minimal script like this: #!/bin/bash echo $PATH it will not match what I get when typing in ...
2
votes
0answers
75 views

Errors with 'echo [A-Z]*'

Errors with 'echo [A-Z]*' I am working on the root directory and intending to print those starting with upper letter. $ echo [A-Z]* Applications Library Network System Users Volumes bin cores dev ...
2
votes
0answers
289 views

Can I modify iTerm window titles for some but not all running commands?

I was looking for a solution to auto set custom title in the terminal based on what command is being run on the current terminal. So, rather than java showing in many tabs - I'd love to have it pick ...
2
votes
0answers
330 views

bash in iTerm2: how to log variables like $TERM_SESSION_ID into command history

To help with recovering history across restarts etc I would like to get some key data, like $TERM_SESSION_ID, stored in my command history. This would be preserved when the command response output in ...
2
votes
0answers
66 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/...
2
votes
0answers
183 views

How to properly esca‌​pe spaces in the res‌​ults of mdfind to use them in a for loop

Trying to answer the question Are true dynamic folders (NOT a “Smart Folder” SavedSearch) possible? I stumbled about the problem to loop the results of an mdfind search as quoted or escaped paths. ...
2
votes
0answers
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 ...
2
votes
0answers
118 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 ...
2
votes
0answers
296 views

Set up a Mac to run OSX (None Browser) application in pure kiosk mode

I've been trying for a number of months, using many methods, to run a Nuiteq Application called Snowflake on our 10 Mac Minis attached to touch-screens in pure Kiosk mode. I'm using Yosemite. These ...
2
votes
0answers
48 views

Using CTRL with bash

Coming from year on Windows, I swapped Cmd and Ctrl buttons. On bash I used to press Ctrl+A/Ctrl+E for jumping to the beginning/end of line. But, since I swapped the buttons I need press Cmd+A/Cmd+E. ...
2
votes
0answers
503 views

Grant rights on a certificate to an app through the shell

I'm currently looking for a way to grant an application rights to a certificate in my /Library/Keychains/System.keychain through the shell. I can currently do this through the Keychain Access App by ...
2
votes
0answers
138 views

Automating VPN switching

I can us a VPN app like tunnelbear to appear to be in other countries, but is there a way to do this in a bash script or applescript? I want to be able to run automated tests on my iOS apps (in the ...
2
votes
0answers
171 views

Terminal hangs when title includes unreachable NFS path

[Edit: reframing to make the question more clear] I use the Mac Terminal to access remote linux systems. On the Mac, the bash prompt is set by: PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}\...
2
votes
0answers
99 views

Terminal: disable printing/output of keyboard commands

I have the same problem as this person – I am running a C script and somehow when I pass the EOF signal with Ctrl+D, ^D gets printed to the console. My question is therefore: is it possible to ...
2
votes
0answers
133 views

Determine when an application last launched

I need to have a script return a date that a particular application launched (in this case Parallels, but solution should be non-specific) so that our asset management system can mark the license for ...
2
votes
0answers
543 views

Bash script to import RootCA and set it to Always Trust from Server

I am working on a way to import a RootCA into the login keychain of OS X and set it to always trust, the cert is located on a file share server. I am relatively new to the whole Bash scripting scene ...
2
votes
0answers
703 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 ...
2
votes
0answers
827 views

bash autocompletion scripts in OS X

Here is what I learned so far: # settings on mac if [[ $(uname) == "Darwin" ]]; then # enable bash completion if [ -f `brew --prefix`/etc/bash_completion ]; then . `brew --prefix`/...
2
votes
2answers
1k views

How to Poll USB mouse through terminal in El Capitan

I've been trying to view which devices are connected to my USB ports through terminal in El Capitan, in particular a USB mouse. I've read online that I can ls /dev/tty.* to view all connected devices. ...
1
vote
0answers
19 views

problems resulting from launchd script running when computer is sleeping

I have a Bash script that copies a specified set of files/directories to a remote server via rsync. It is run by launchd as a Global Daemon every day at 3am. The computer is sleeping most of the time ...
1
vote
0answers
39 views

Install for all users an Application from a DMG

I trying to install with a Bash script an Application like Slack when I create a new Macbook. Connected as the admin user I run those command sudo hdiutil attach -nobrowse /Users/admin/Desktop/post-...
1
vote
0answers
21 views

Using bash/terminal to get battery draining apps

I have the following Macbook Pro model. I would like to find the apps that are consuming considerable power from the terminal so that I can kill them if I am on battery power. All searches so far ...
1
vote
0answers
48 views

What makes Catalina make a shell script quarantined?

I am routinely editing shell scripts (bash). One of them gets quarantined whenever I modify it. When I run it, I get the error: $ ./opg.sh -bash: ./opg.sh: /bin/bash: bad interpreter: Operation not ...
1
vote
0answers
167 views

PS1 setting on macOS using Modulo

I'm trying to set up my PS1 setting in my .bash_profile for my company laptop (Touchbar Mac) and noticed special characters like \u and \w were being used literally. I tried using the single and ...
1
vote
0answers
20 views

using breakpath command in shell file

From somewhere I have available in the macOS 10.15.1 Terminal window the command "breakpath", which gives as output the entries in $PATH, one per line. And I can redirect its output, e.g.: breakpath &...
1
vote
0answers
15 views

Bash-completion breaks hosts tab completion

Prior to installing Bash Completion, hitting the "tab" key after an "@" character would autocomplete hostnames listed in /etc/hosts. For example, if I started typing: drush @lo [tab] It would ...
1
vote
0answers
48 views

How to pass filename as an argument passed on launch?

I would like to pass the script's filename to the "Arguments Passed On Launch" found in the Scheme editor under "Run". I looked at this Xcode documentation but did not find an answer. Currently, I ...
1
vote
0answers
153 views

Applescript to set environment variable before opening terminal

I have the following Applescript in a workflow assigned to a service hotkey that opens a terminal in a given Finder window: tell application "Finder" set myWin to window 1 set thePath to (...