Questions tagged [bash]

The Unix shell formerly used by Terminal in macOS until 10.15

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

Unable to mount an SMB share from cron

I have a script to temporarily mount an SMB share and copy some files that get generated for my team. It works find locally, but fails to mount the remote share when run from cron. I am not including ...
0
votes
1answer
31 views

How do 3rd-party programs modify the $PATH variable?

When I echo my $PATH variable, I see the binaries of some programs that I have previously uninstalled, and conversely, I do not see the path to some of the binaries that I can use, such as code. I am ...
1
vote
2answers
719 views

Automator: Move files into new subfolder based on file's name

Disclaimer, this may not be something Automator can do. I have a large directory of movie files. In order to use a piece of software, each movie needs to be in it's own folder. I'd like to create ...
5
votes
2answers
12k views

Launchctl says plist is invalid, plutil says it's OK

I'm trying to have launchd run a shell script when I join a new WiFi network. I've created this plist file (closely based on this SuperUser answer) at /Users/myname/Library/LaunchAgents/my....
11
votes
3answers
14k views

Git auto-completion not working on Mac OSX 10.11.5 El Capitan

I have tried the examples found here to get Git auto-completion working on El Capitan, however none of the examples work for me. I installed bash-completion with Homebrew (brew install bash-...
369
votes
13answers
193k views

git auto-complete for *branches* at the command line?

On my Linux machine I have autocomplete for branches with Git. [Note we are talking about git branch completion, not bash completion (e.g. commands, files, etc). Thus NOT Lane's answer at all] For ...
0
votes
1answer
14 views

pdfsplit fails to start

pdfsplit returns the following error when launched from terminal: pdfsplit --version -bash: /usr/local/bin/pdfsplit: Bad CPU type in executable OS: macOS Catalina 10.15.2 file Checking ...
1
vote
2answers
69 views

How to (and should I) put a path to user-installed python ahead of system-installed python?

I have a separate installation of Python 3.*, but the first python path in my $PATH variable is the path to system-installed Python. Is this how it should be? I have added the path to user-installed ...
1
vote
1answer
29 views

How to conveniently restart pgAdmin 4?

I have pgAdmin on my dock, and can open it when the process isn't already running (ie. after a restart, or if I manually kill it). If I open pgAdmin, close the window, then later try to open it from ...
1
vote
1answer
36 views

No package manager on brand new macOS Catalina

I'm sorry if this is a stupid question, but I've been searching for days with no results. What is the default package manager for macOS Catalina terminal? % brew zsh: command not found: brew I've ...
0
votes
0answers
9 views

Get iTerm notification when remote SSH session command is completed

I'm trying to make iTerm give me a notification whenever a command I run in an SSH session completes. To do this, I set marks whenever I run a command which notifies me whenever the command completes. ...
2
votes
2answers
644 views

How can I make sure that the title of a Terminal tab/window is identical to the command I typed

I noticed that for aliases etc the title of a Terminal tab/window often isn't the same as the command I typed. This is sometimes confusing, especially for long-running processes with similar names. ...
82
votes
5answers
57k views

Is bash in OSX case-insensitive?

Are bash commands on OSX case insensitive? I type "which TR" and it shows /usr/bin/TR, though there is no such binary there. Same thing for other binaries, when capitalized. Or is Terminal.app maybe ...
38
votes
6answers
19k views

Tab completion for hosts defined in ~/.ssh/config doesn't work anymore on Yosemite

I'm trying to create my ~/.ssh/config file for simplify my work life on the server connection. In Mavericks all worked properly and with the tab I was be able to autocomplete the hostname with file ...
2
votes
1answer
65 views

How to get fn + left key working on macOS after changing to zsh from bash?

In case it is not clear fn + left key is simply the HOME button. It takes you to beginning of line. This seems to still work when editing a file (in vim) say so I think zsh does something with the ...
2
votes
1answer
41 views

Cron job not exiting in Catalina; leaving zombie processes [duplicate]

I just upgraded to catalina a few days ago. I'm still using bash which has been installed with homebrew. The ps aux | grep bash command is showing a new bash process is forked every minute. After a ...
14
votes
8answers
2k views

In Terminal I cannot type lowercase e

If I open a Terminal window and I type the letter "e" (without quotes of course) it beeps and will not type the letter. Every other letter works just fine in Terminal. Uppercase E works too. Just ...
31
votes
2answers
35k views

How do I edit current shell command in VI

I have seen in blogs on Linux machines you can edit the current bash shell command in VI (or whatever the EDITOR is set to) by pressing ctrl-x,ctrl-e. This doesn't seem to work on 10.8. Any ideas on ...
0
votes
1answer
23 views

trying to run FSF emacs in character based mode ( -nw ) on Catalina

After installing Catalina on my laptop emacs vanished so I installed the latest version from FSF. Running it in a window (gui mode) works fine but I can't get it to reliably work in character mode in ...
14
votes
5answers
32k views

Turn Wifi off/on with a single key?

Is there a way to assign the WiFi on/off function to one of the function keys like F4 that I otherwise never use? I assume Applescript would be required. However I may want to use a BASH script ...
3
votes
3answers
626 views

Why does 'set -x' cause the terminal to dump garbage

This problem is quite annoying and I cannot search Google for 'set -x' because the minus sign has another terminology there. In my MacBookPro, when I use 'set -x' to debug bash commands, I'm getting ...
0
votes
0answers
30 views

How can I change the color of Terminal's shell prompt and create new empty line entering after a command?

I am trying to permanently change the bash prompt color to blue as well as create a new empty line after I run my command to make the terminal easier to read. Before I tried to make changes, I had ...
2
votes
2answers
45 views

Using the command-line / Terminal, is it possible to determine if this Mac has Touch ID or not?

I am trying to find a way, using the Terminal/command line, to determine if the Mac I am using has Touch ID or not. So far web searches have not turned up any answers. I would have thought that ...
0
votes
0answers
29 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 ...
265
votes
4answers
214k views

What is the difference between .bash_profile and .bashrc?

To make an alias for the Terminal in OS X, you can either put the aliases in .bash_profile or .bashrc. What is the difference between the two and why would I choose to put aliases in one and not the ...
1
vote
1answer
61 views

bash not finding executables on Catalina: why & how to fix?

As I was typing the title, I saw a suggestion that this might be a duplicate of. But the suggestion vanished before I could click on it. 'sh' is actually bash sh: sleep: command not found sh: ...
16
votes
2answers
33k views

Why do I need to put sh before running .sh files?

When I want to run .sh files in Terminal, I need to put sh in front of them. Is there any way to avoid this, and thus save typing?
0
votes
3answers
478 views

Run zsh alias via automator?

I am using zsh with oh-my-zsh in iTerm on macOS. There are some aliases defined in my .zshrc I use often, like this: deploy(){ cd ~/Path/To/My/Project; build ...; rsync ...; } To execute this, I ...
2
votes
1answer
74 views

Resetting /usr/bin

So I was installing python3, pip, and a few other applications through Homebrew when I first got my Mac. I realized I was doing all this in /usr/bin and not /usr/local/bin, and I wanted to just to ...
0
votes
1answer
27 views

Batch rename files replacing non-alphanumeric characters with underscore

I would like to recursively rename several files located in all subdirectories of a parent folder. I would like to remove spaces and other non-alphanumeric characters and replace them with an ...
2
votes
1answer
153 views

-bash: /usr/local/bin/nmap: Bad CPU type in executable

I recently update my Mac OS to Catalina 10.15. I ran nmap I kept getting -bash: /usr/local/bin/nmap: Bad CPU type in executable I've tried reinstalling it brew uninstall nmap brew install nmap ...
1
vote
1answer
116 views

MacOS command-line security updates: equivalent for apt-get update all

I am accustomed to updating systems with sudo apt get update and would like to ensure MacOS security updates are installed from the command line. This `software update' command was issued on my ...
91
votes
5answers
220k views

Getting all files from a web page using curl

I would like to download the files, all at once, from the following page using curl: http://www.ime.usp.br/~coelho/mac0122-2013/ep2/esqueleto/ I tried curl http://www.ime.usp.br/~coelho/mac0122-2013/...
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 ...
0
votes
1answer
211 views

Add colours to output of existing CLI commands

I would like to create a function / alias that colorizes the output of another command. Is there a best-practice way to do so? For instance, let's take the alias command, whose output looks something ...
9
votes
4answers
15k views

Why `echo -n` doesn't work in this script on mac terminal?

I am learning shell from tutorialspoint today:http://www.tutorialspoint.com/unix/unix-shell-loops.htm And I copied this code block to a loop.sh file: #!/bin/sh a=0 while [ "$a" -lt 10 ] # this ...
0
votes
0answers
45 views

Running “do script” synchronously in AppleScript

I have the following AppleScript that I run on login: on run {input, parameters} tell application "Terminal" do script ".../MyScript.sh" end tell return input end run I run ...
16
votes
7answers
14k views

Is there a Mac OSX equivalent of zenity?

I'm porting some simple X windows/bash scripts to Mac OSX, but I cannot find a build of Zenity (a Gnome app for basic GUI dialogs) for OSX. Is there some other command line driven dialog utility I can ...
1
vote
3answers
329 views

osascript display dialog hangs when screen is off; detect unavailable GUI/display from bash or applescript?

NOTE: If you have this problem, the answer from @abc helps mitigate it--but there are still unknown conditions under which this solution won't keep the osascript from executing and hanging. ...
1
vote
1answer
349 views

How to set “default” .bash_profile when opening Terminal on Catalina

I'm running Catalina, 10.15.2, which uses the new zsh shell as a default. I've created my own .bash_profile file in my home directory and I'm able to initialize this .bash_profile by typing: source ....
2
votes
0answers
61 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
1answer
83 views

Process completed after opening terminal

I am running a bioinformatics course that gave the following instructions to setup my previously non-existing bash profile: You will need a few lines in your setup files. Open a Terminal and run ...
0
votes
2answers
79 views

Bash - moved /Users/me to /usr/local/me - how to move it back and not break anything?

I was trying to set up Tomcat to use with Java, and somehow moved /Users/me to /usr/local/me. When I try to open any icons on desktop, they do not open, but everything that was already open still ...
0
votes
0answers
81 views

syspolicyd assessment denied

My server has a bash script that executes twice a day, so far so good, it worked for a looong time. Yesterday I updated the server OS to Catalina and then the script stopped working. I've checked ...
10
votes
3answers
12k views

How do I restart the cron service on OSX?

ProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G31 $ sudo cron restart cron: cron already running, pid: 257` None of the answers in here https://stackoverflow.com/questions/...
1
vote
1answer
91 views

Process completed immediately after opening Terminal and impossible to add commands

Since I have made some changes on my .bash_profile document, when I open my terminal I got this message and I cannot add any command : Last login: Thu Dec 19 10:02:58 on ttys000 [Process completed] ...
5
votes
3answers
500 views

Now that MacOS Catalina has moved to zsh, can I upgrade bash 3.2.57 with 5.0.3?

I understand apple's move from bash to zsh, though I'd really rather that they hadn't made the change. I've tried zsh, and decided that I'd prefer to remain with bash. So, since MacOS Catalina isn't ...
0
votes
1answer
35 views

How can I run a command which will not survive terminal close?

I want to send a notification in X seconds to future me, but I don't want to send the notification if I closed the terminal. So let's say I want to send myself a notification in 10 seconds: ...
0
votes
2answers
72 views

Automator Change to directory of dropped files before running Shell command

Seems extremely simple, but I can't figure it out... I want to be able to change to the directory (folder) where the dropped file is located before running my shell script on that file. So either I ...
7
votes
3answers
780 views

How can I find the “friendly name” of the operating system from the shell / Terminal / bash?

I know that I can use sw_ver to find this information: ProductName: Mac OS X ProductVersion: 10.14 BuildVersion: 18A353d …and I know I can find other things like uname can give me some types of ...

1 2 3 4 5 27