Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [bash]

The default Unix shell used by Terminal in macOS

-2
votes
0answers
31 views

How to fix 'Too many levels of symbolic links' error in virtuanenv? [on hold]

I am getting error (Too many symbolic link levels) while setting up virtual environment in Django web application framework. I tried to look the following question and answer on Stack Overflow: ...
1
vote
1answer
59 views

Automator to remove all text before hyphen ( - )?

I'm trying to create an Apple Automator application that will rename a group of files by removing all text before and including a hyphen ( - ) that will post an error if trying to rename a file with ...
2
votes
3answers
4k views

How can I set the iTerm2 window title to be the same no matter which pane is selected?

I'm aware that the iTerm2 window title can be set with echo -ne "\033]0;"Title goes here"\007" but that appears to only set the title for a single pane. When I switch panes, the window title is ...
0
votes
2answers
112 views

Display emoji faces for correct & wrong commands in terminals

I want to customize my terminal to display emoji faces, showing sad face for wrong command and happy face for right command that I enter. Is there any way that I can do this using my terminal bash. ...
1
vote
1answer
41 views

bash $PS1 containing an emoj

This question is related to https://apple.stackexchange.com/a/357132/44531 I would like to have a space after the emoj 😱. I've tried in the script below but I'm getting two lines instead of the ...
1
vote
3answers
1k views

How do I remove a ColorSync profile from a JPEG image from Terminal in El Capitan?

I have several images that I would like to strip the ColorSync profile from. Eventually, I would like to automate this in bash so I could easily process this on a file or folder from the contextual ...
0
votes
0answers
15 views

On Mac terminal keyboard key action macros?

I want to assign long commands in one key on Mac terminal. For example, I have assigned command php bin/magento under F13 key from "Terminal → Preference → Profiles → Basic → ...
1
vote
1answer
143 views

How to open multiple iTerm2 tab with admin privilege

So I have an executable program in my /usr/local/bin/ called myApp. I need to run multiple myApp processes in new iTerm2 tabs with sudo. The file structure is like this: --myFolder ----v1 ----v2 ---...
0
votes
0answers
23 views

Add IP alias on macOS like on Ubuntu? [duplicate]

I want to add a second IP address on my Mac like on Ubuntu. On Ubuntu I use this: $ sudo ip addr add 192.168.1.12/24 dev eth0 On my Mac I used this: $ sudo ifconfig en0 alias 192.168.1.12/24 On ...
3
votes
1answer
33 views

Is it possible to fix the spacing when using “ls” with colored output?

This is the exact same issue found here: https://unix.stackexchange.com/questions/165154/changing-the-spacing-between-files-in-ls When you run the command ls -G or CLICOLOR=1; ls the spacing in the ...
2
votes
1answer
18 views

Set sshd to serve different shell based on `host`

I want my local sshd to serve different shell, based on the host. Example: ssh user@hostname1 -> get's bash ssh user@hostname2 -> get's fish Is it possible, and if so, how can it be done?
8
votes
3answers
14k views

Change Terminal.app's Default Shell to BASH

How can I change Terminal.app's default shell to BASH? For some reason, my friend's Mac (10.6.6) defaults to using TCSH instead of BASH. The obvious remedy is to choose /bin/bash as the command to ...
2
votes
1answer
66 views

Terminal PATH startup message

I messed up when installing Cisco Packet Tracer for Linux and it some how changed a few bash files. After a few hours of looking around and changing my PATH, when I open a new Terminal window I get a ...
16
votes
4answers
12k views

Change file association in terminal?

Is there a method for associating file types with applications via terminal? I thought ~/Library/Preferences/com.apple.launchservices.plist might do it, and I also have seen: Why is a command line ...
9
votes
2answers
4k views

Auto-updating Homebrew

i'm currently using the Homebrew package manager and my question is: is possibile to write a bash's script in order to execute brew update and eventually brew upgrade whenever opening a shell for the ...
1
vote
0answers
35 views

iTerm2 still opens old shell after Bash upgrade

I tried upgrading my MacOS Bash from 3.2 to the latest version as in this article. It involves installing the latest Bash with Homebrew and then setting the default shell with chsh. However, chsh ...
3
votes
1answer
51 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/...
2
votes
1answer
37 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. ...
0
votes
1answer
53 views

Why does chunkwm fail with “Permission denied” error for .chunkwmrc

ashleyharvey@Themis:~$ ls -al .chunkwmrc -rw------- 2 ashleyharvey staff 4.7K Apr 4 22:24 .chunkwmrc ashleyharvey@Themis:~$ chunkwm /bin/bash: /Users/ashleyharvey/.chunkwmrc: Permission denied So, ...
1
vote
1answer
21 views

LSCOLORS format

I want to configure my .bash_profile and I've seen this post about BSD based ls configuration: https://www.cyberciti.biz/faq/apple-mac-osx-terminal-color-ls-output-option/ I just don't know what is ...
0
votes
1answer
42 views

Get parent of symbolic link instead of original folder

I have a project with node_modules folder that contains a symbolic link to another project. The problem that inner project takes configs from parent project (etc ../../../config) and thus cannot find ...
1
vote
3answers
51 views

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

background I've been working on a backup script that runs occasionally via launchd. When it runs, it prompts me with something like: osascript -e "display dialog \"Is now a good time to back up?\"" ...
0
votes
2answers
121 views

After uninstalling Oh-My-Zsh, my terminal is messed up

This is not a duplicate question. I've already looked at the answers for Uninstalled zsh, terminal gone weird, and although I changed the settings, it still defaults back to zsh title, with a ...
1
vote
1answer
14 views

How can I change the ownership of the unwritable directories for Homebrew?

I had admin account before and I deleted the admin and made the user as admin because it was bit of pain in neck. This is now the admin user called zuhairhallak. Before, installing Homebrew, it was ...
0
votes
1answer
17 views

Failing to send Wake-On-LAN UDP packet with netcat

I'm trying send a WOL packet from a bash script under Mojave, much like https://stackoverflow.com/a/31588036/9370650, without any third-party utilities, such as the nifty https://github.com/jpoliv/...
4
votes
0answers
29 views

Is there a script/cmd that I can create/run that will allow me to install .dmg? [duplicate]

I have been working on a "Mac Rollout Project". After I run the Macs through the Apple setup, I have a list of .DMG / Applications that I have to install. There is no particular order that the .DMG / ...
15
votes
5answers
12k 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 ...
0
votes
1answer
60 views

How to remove special character from a folder name?

I am creating a folder like mkdir -p ../service/target/static but windows creates it with some special character static. I need to explicitely remove that special character using shell script. I ...
3
votes
1answer
1k views

Why is .bash_history periodically wiped?

This is the second time it's happened. I just tried grep-ing some historical commands and came up empty. a look at my bash history shows that it's practically empty. Like it's been wiped clean. I use ...
3
votes
1answer
55 views

Extract numbers from string using shell

Using shell script, how do I extract two sets of numbers from a string like "R14C11"? I'd like to get the result as an AppleScript list. R14C11 -> {14, 11} R5C9 -> {5, 9} "R" and "C" will be ...
2
votes
2answers
360 views

what is `tput rmam`

tput rmam turns off line wrapping on the terminal.app I always forget this command, because I never figured out what rmam stands for. Anybody knows?
1
vote
0answers
61 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 ...
1
vote
1answer
46 views

Where in the file system is my shared folder? (AKA: Where is /Volume, and Why Can't I Open It in Finder?)

I want to run a bash script periodically to track the size of a shared drive on my network. The command that produces the data I want is du -sh. I have created a Login item to mount the shared drive ...
18
votes
6answers
6k views

Slow Terminal on Sierra

The Terminal app is slow at reacting to input, lag is very noticeable when I press and hold Enter. When I type bash to create a sub-shell it becomes much faster. I believe this behavior started when ...
1
vote
2answers
707 views

Shell script from Applescript

This has been driving me crazy. I have a script which is an executable within /usr/local/bin/, which works perfectly in Terminal, but I am unable to get Applescript to call it: RunShell("estc R505") ...
0
votes
1answer
86 views

Removing directories from PATH

I am trying to run rkhunter, but it is giving me this output: stack/security/rkhunter-1.4.6 ➜ sudo rkhunter --check Password: Invalid BINDIR configuration option: Invalid directory found: ~/.dotnet/...
6
votes
3answers
669 views

How to launch pf at startup?

I am looking for a pretty elegant way to launch the pf - a.k.a. Packet Filtering - process at startup. Using the launchctl or the pfctl commands, root privileges are required and so it is useless to ...
0
votes
1answer
34 views

Encrypt password with security command

I want to deploy smb password with ARD, or create a small script. With the command security I have the possibility to add a password in keychain without share the password. security add-internet-...
1
vote
3answers
78 views

How to open PDF as BASH variable?

I'm trying to open a PDF using Preview where the input file is a shell var: $ pdf=$(wget -qO- 'http://website.com/file.pdf') && open "$pdf" $ pdf=$(wget -qO- 'http://website.com/file.pdf') &...
10
votes
5answers
16k views

I broke my PATH by editing my ~/.bash_profile and Bash will not recognize most commands

in .bash_profile I accidentally set the path to: PATH="~/Tools/apache-maven-3.3.3/bin" and now the default path is gone. Nothing in Terminal works anymore: Korays-MacBook-Pro:~ koraytugay$ ls -bash:...
26
votes
5answers
97k views

Using terminal to get current fan speed?

I would like to view the current fan speeds of my MacBook and iMac using terminal. I've found that running spindump then cat /tmp/spindump.txt | grep "Fan speed" will show it, but that's very slow and ...
0
votes
2answers
78 views

How to get error status back to bash from osascript

Inside a bash script, I'm closing the front window of whatever application is foreground. I'd like to know if the command failed (when the foreground application doesn't have a front window. I tried ...
7
votes
2answers
733 views

Difference between two quite-similar Terminal commands

I have a script that I run as part of my development (it's the activation script for a Python venv environment). The way the documentation suggests that we run it is by going to the folder containing ...
38
votes
5answers
6k views

.git-completion.bash producing error on macOS Sierra 10.12.6

I've followed the process for git-completion as per the description provided at https://medium.com/@farooqyousuf/autocomplete-git-commands-and-branch-names-in-terminal-on-mac-os-x-4e0beac0388a: The ...
1
vote
2answers
801 views

'sudo ifcong en0 down' - does not stay down in OS X?

My goal is to terminate all ethernet traffic through en0 until I bring it back up with ifconfig en0 up. When I run ifconfig en0 down through terminal, and then confirm ifconfig and all interfaces are ...
3
votes
1answer
44 views

Attach one .dmg file on different computers at the same time (hdiutil attach)

I have a question about "hdiutil attach" I've "created" (ctrl+c/ctrl+v) one bash script to execute some .app automatically. First im mounting shared folder: mount_smbfs -o nobrowse //SERVER/share "...
1
vote
2answers
185 views

Disable Force Touch from terminal using Bash or AppleScript

Is there a way to disable (or do other things to) the Force Touch settings using either shell scripting or AppleScript? Hacks accepted.
2
votes
3answers
1k views

Prevent terminal tabs from auto-renaming

I like to name my tabs when I'm using Terminal so I can keep track of what's inside of them. I do this using the inspector. Unfortunately, whenever I ssh into a machine, my tabs get renamed. Is ...
1
vote
3answers
2k views

Changing color of folders, files, execs on iTerm2

on iTerm2 bash If there any way to change the color when 'ls' so i can quickly know if it's a directory, a file, a script, exec? Just like the Ubuntu terminal so you know a directory color for ...
2
votes
2answers
51 views

How to show current time in mac terminal prompt?

I have this: PS1+="\D{%H:%M:%S}"; But this displays the time the prompt started. I want the prompt to show the current 12 hour (not 24 hours) time live (so it keeps changing, and then when a command ...