Questions tagged [bash]

The Unix shell formerly used by Terminal in macOS until 10.15

163 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7
votes
0answers
359 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
901 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 ...
4
votes
0answers
587 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 ...
4
votes
0answers
150 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
1answer
4k 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 ...
4
votes
0answers
3k 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
537 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 ...
3
votes
0answers
73 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
451 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
662 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 ...
2
votes
0answers
1k views

How can I determine the source of this permission message? “bash“ wants access to control “System Events“

I occasionally receive this permissions message in MacOS 10.15.5: “bash“ wants access to control “System Events“. Allowing control will provide access to documents and data in “System Events“, and to ...
2
votes
0answers
203 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
29 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
149 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
769 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
306 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
101 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
80 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
77 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
321 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
391 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
67 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
221 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
124 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
316 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
107 views

“terminal-notifier.app is not open anymore”

From a .plist loaded to Launchd I run a bash script which displays a notification using terminal-notifier. The notification is displayed fine, but when clicked the message "terminal-notifier.app is ...
2
votes
0answers
563 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
143 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
189 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
111 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
136 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
578 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
747 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
835 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
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
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 ...
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=...
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
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
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) ...
1
vote
0answers
32 views

How to write to iCloud in Terminal? (Currently seems read-only)

I have a bash function that writes to a markdown file. Here it is in its simplest form: function n() { echo $@ >> path/file.md; } This works fine. However, when I change the path to an ...
1
vote
0answers
46 views

Automatically run script on login (MacOS 10.15)

Because of a small disk I've got an external USB-C SSD drive where I want to move some software projects I'm currently no working on. To see the outsourced projects in my default projects directory in ...