Questions tagged [bash]

The Unix shell formerly used by Terminal in macOS until 10.15

Filter by
Sorted by
Tagged with
17
votes
5answers
34k 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 ...
9
votes
5answers
20k views

chsh doesn't change $SHELL

I'm having some difficulties in changing the value of $SHELL in OSX's iTerm app. iTerm is starting in /bin/zsh, but the value of $SHELL doesn't seem to change. What I've done: Changed "command" as /...
31
votes
6answers
115k 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 ...
1
vote
1answer
54 views

Terminal “history” command brings back different results

In OSX's terminal, I run the history command to find my recent commands. Often I notice recent commands will not show up, seemingly randomly. For example, I will log on one-day and notice my commands ...
25
votes
4answers
45k views

iTerm colors for Prompt, Command, and Output

Right now my iTerm2 looks like this... Everything is the same color and is hard to read. Can I make any of the Prompt, Command, and Output different colors like this?
0
votes
0answers
62 views

macOS Big Sur and bash

In Catalina, Apple made zsh the default shell - however, it retained the (now deprecated) bash. Despite my attempts to unearth something related to this, I couldn't find out whether Big Sur will keep ...
31
votes
4answers
62k views

Missing ftp command line tool on macOS

Use ftp to obtain source code. I am following a linux command line book to learning compiling. [me@linuxbox src]$ ftp ftp.gnu.org Connected to ftp.gnu.org. 220 GNU FTP server ready. I tried and ...
14
votes
5answers
11k views

Playing alert sounds from terminal

Is there a way to play OSX alert sounds from terminal? The alert sounds that are listed in System Preferences > Sound > Sound Effect Tab
1
vote
2answers
117 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 ...
2
votes
2answers
111 views

Resetting /usr/bin [closed]

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 ...
224
votes
13answers
406k views

Why doesn't .bashrc run automatically?

I put some alias commands in my .bashrc file, so that they might be loaded everytime I open a new Terminal window. Yet this doesn't happen. I have to select run script: in the Terminal>Preferences>"...
27
votes
1answer
32k views

Using bash/terminal to get number of battery recharge cycles

I would like to get the number of recharge cycles using bash (terminal commands). I understand the following command will display all of the battery data, but I want the cycle count on its own ioreg -...
3
votes
3answers
860 views

I switched to Catalina and enabled ZSH now my home/end key do not work in terminal

I switched to ZSH from BASH as per the upgrade in Catalina and all is well except my home/end keys no longer work. This can be really annoying trying to move my cursor over super far to the left ...
4
votes
1answer
69 views

Cryptographic Integrity and Authentication Validation of Homebrew Installer?

Is there a way to install homebrew on MacOS such that anything downloaded from the Internet is cryptographically validated for integrity and authenticated to the actual publisher? Unfortunately, the ...
0
votes
0answers
44 views

Why is Apple changing the default shell to zsh? [duplicate]

As bash is so broadly available, it provides a good compatibility layer for users that come from other Posix systems to use macOS. Why the move to zsh as the default shell, and why the extensive ...
2
votes
1answer
36 views

Bash terminal windows and tabs take a few seconds to start

The problem appeared after using the Migration Assistant. Edit: There is no command in Preferences>Profiles>Shell. Both .profile and .bashrc are empty. Putting set -x at the beginning didn't help me ...
3
votes
1answer
44 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?
5
votes
1answer
74 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?
1
vote
2answers
74 views

Want launchd to run a script weekly, but it is running it daily instead

I wanted to write a simple launchd job that runs a script every Monday morning at 7:00 am. The goal is to pull an image from tapmusic.net that catalogs my last.fm listening habits from the prior week. ...
0
votes
0answers
21 views

Get per-core CPU usage in terminal in machine-readable format

I need CPU utilization for each core. I want text-based output in the terminal. htop technically contains the information I need, but the output is not suitable for my use case as I need to pipe the ...
0
votes
0answers
11 views

Terminal shows “active process” as “-zsh ▸ -zsh”

I have configured Terminal.app to show the "active process" in the tab title. When I open a new Terminal tab, it shows the corresponding field as "-zsh ▸ -zsh" rather than just "zsh" by default: My ...
1
vote
1answer
20 views

How to get (logical) screen size from a shell script?

Using system_profiler SPDisplaysDataType, I can retrieve the size of a Mac's display in pixels. However, the command tell application "System Events" to get the size of every window of every process ...
0
votes
0answers
14 views

Bash Command to Export System-Roots Certificates in Mac

I am trying to write a script to export all the system-roots-certificates from Keychain Access -> System Roots -> Certificates to a path as cert.pem file. When i tried the below command it did not ...
0
votes
1answer
65 views

Run script at sunrise time

I'm trying to set my hackintosh pc to turn on at every sunrise and to run iTunes as the macOS boots up using bash or AppleScript without 3rd-party apps. I reached the point in my script when I need ...
0
votes
0answers
24 views

How to set CUPS user in Catalina

Some background info: I am managing a CUPS printserver with printqueues for all the user accessible printers. The macOS clients get their printqueue set up as IPP via script. Once the printjob has ...
0
votes
0answers
22 views

How to use variable in alias termux?

my alias for opening Google is is like this alias g="termux-open-url https://google.com" for search url look like this http://google.com/search?q=what+I+search I wanted that if I write g what I ...
0
votes
0answers
20 views

Run long running command in Terminal tabs using commands

From a .command file, I want to write steps so that multiple terminal tabs are opened and in each of those tabs a long running command is run and then my .command file should complete without stopping ...
1
vote
2answers
2k views

Shell not finding commands after I changed my .bash_profile file

I was following a tutorial trying to install Laravel (5.0). The tutorial showed to add export PATH="~/.composer/vendor/bin/laravel" to the .bash_profile document. Since then, I am not able to execute ...
3
votes
1answer
3k views

MacBook Pro stuck on GRUB minimal Bash at startup

I had a dual boot Linux Mint 19 and macOS on my MacBookPro11,2. Since the CPU was overheating with Linux, I decided today to delete the Linux partition. Little problem, when I start my MacBook Pro now,...
0
votes
3answers
379 views

How to change the `sh` command to run scripts in bash 4

I have installed bash 4 with Homebrew and bash --version shows me the version 4. If I have following test script: #!/usr/local/bin/bash # test-version.sh echo $BASH_VERSION And I make it executable ...
1
vote
2answers
50 views

Change the shell that functions use

In my current terminal setup, I make use of zsh; it's my default shell. I also have an up-to-date version of Bash for other reasons installed from Homebrew. However, there is also the Bash provided ...
3
votes
3answers
1k views

macOS Catalina still uses bash as the default shell

I'm on the latest public beta of macOS Catalina and it's supposed to use zsh as the default shell and it even shows that it is pointing to zsh in the users settings but whenever I open a new terminal ...
0
votes
3answers
860 views

How to caffeinate a function on CLI?

Mac's caffeinate tool accepts the name of a utility: caffeinate sleep 1, for instance. Is there any way for it to accept a function as well? For example: function mysleep { sleep 2 } caffeinate ...
387
votes
14answers
202k 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
0answers
37 views

Obtain Full Path of Copied File from Finder (Without special copy command)

When copying a file in Finder (Command + C) and pasting it (Command + V) in iTerm2 or Terminal the full path of the file gets pasted. I wanted to use this in a script by calling pbpaste but this only ...
0
votes
0answers
21 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 ...
0
votes
0answers
32 views

launchd running php script fails under Catalina on exec diskutil

I have a php script that worked perfectly under Mojave from the terminal and as a launchd job. After changing to Catalina, the php script continues fine from the terminal, but the launchd job fails on ...
0
votes
1answer
27 views

Safe way to get “rm dir -rf” working (place options after dir name like on linux)

I don't know how many times I've done it. I'll type in rm dir and then have to move the cursor back and add in -rf to the command. Probably 10,000. In linux, I can just add the options in after the ...
0
votes
0answers
60 views

I can't reinstall my OS X El Capitan. “Please Run Install OS X El Capitan.app”

I'm in recovery mode, but when I try to reinstall the OS this shows to me. I've entry to the terminal of Recovery OS. And I found that file .app In other forum I found that the solution is move that ...
0
votes
2answers
37 views

Can't launch Finder window from terminal on Mojave

open isn't behaving as expected on Mojave. Running open /Library/ gives LSOpenURLsWithRole() failed with error -600 for the file /Library. This happens regardless of the opening location. I'm ...
0
votes
1answer
32 views

Trying to add cronjob results in “”LICENSE“:0: bad minute”

I am trying to set up a cronjob to run every minute with the following command: crontab * * * * * sh /Users/username/Downloads/reddit-notifications-master/notifyer.sh notifyer.sh has the following ...
0
votes
1answer
15 views

iTerm unresponsive as xcode attempts (and fails) compiling every startup

Very recently, iTerm has become unresponsive for me when I open new instances of it. Whenever I open a new window or tab of iTerm, Xcode seems to be attempting to recompile a slightly older version of ...
5
votes
3answers
2k views

How to grep with filename highlighted in one color, and the match highlighted in another color?

On the Mac, I can't seem to use grep and have the filename highlighted (or in) a certain color, and have the matching string in a different color. Is there an easy way?
0
votes
0answers
19 views

MacBook Pro 2011 Single-user mode hangs

I have a MacBook Pro 2011 with known GPU-problem and MacOS High Sierra on board. 3 years ago I solved this problem with this tutorial: link So I need terminal to enter commands, but I can't enter ...
0
votes
0answers
22 views

Why do my environment variables keep getting wiped out in Mac OS Catalina?

I am currently using MacOS Catalina, and every time my computer boots up from having shut down the environment variables get wiped out. I literally have to manually run export FOO=bar each time my ...
293
votes
5answers
232k 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 ...
0
votes
1answer
36 views

Catalina's zsh and its .zshrc file

I am trying hard to wrap my head around zsh "upgrade" from bash in macOS Catalina. Most of the things are great, actually. However, I cannot figure out why I am experiencing difficulties, like ...
3
votes
2answers
18k views

How do I remove the source (base) from my terminal?

I created some new aliases in my .bashrc file and did source ~/.bashrc Now, everytime I open my terminal it always comes with the (base) How do I remove that?
0
votes
1answer
36 views

Merge audio and video in a monitored folder

I want to create a script on mac that monitors a folder and merge the video and the audio. But if file01 exists (previous merge file) I want it to create file02 and if this one exists I want it to ...
4
votes
2answers
2k views

Install automator service via command line

I would like to automate my Mac installation flow for services. The following is my script: #!/bin/sh rm -rf ./tempWorkflows mkdir tempWorkflows for filename in ./*.workflow; do cp -R "$filename" ...

1
2 3 4 5
29