Questions tagged [bash]

The Unix shell formerly used by Terminal in macOS until 10.15

Filter by
Sorted by
Tagged with
5
votes
3answers
864 views

Did the shell ( terminal ) change in Catalina?

My login script is behaving oddly since I moved to Catalina. Particularly this line: # set cursor to display path and command count PS1="<: \w | \! :> " Now my cursor actually has a \w and a \...
3
votes
1answer
62 views

List all aliases starting with a particular string

To improve on the steps I have to take to complete some actions on my Mac, I have created many aliases. Example: To open System Preferences, which I have to do often to manage multiple monitors, I ...
0
votes
1answer
44 views

How to measure the time in milliseconds from invoking the command in MacOS OSX bash until the command begins execution?

We are looking for a way on a Mac to measure the time in milliseconds from after a shell script issues a command until that command actually begins execution on the cpu. This time would represent the ...
0
votes
2answers
1k views

Programmatically Change Screen Saver “Start after” time

I would like to change the time before my screen saver starts based on WiFi network. I am running Yosemite (10.10.1). I will use Keyboard Maestro to trigger the action. I need to find the correct ...
26
votes
4answers
157k views

How to create ~/.bash_profile and ~/.profile

So, I don't have .bash_profile neither .profile in my home folder. How do I create them? After that, what should I do so every time I open the terminal these files get read?
0
votes
2answers
80 views

Can I handle the Apple Event “open” within a bash shell script using osascript command?

I use a bash script (myJavaBash.sh) within an Application Bundle (myJavaJar.app), that starts "java -jar myJarFile.jar" with additional JVM arguments (which works fine so far). My goal is to pass a ...
1
vote
1answer
76 views

Executing bash file with Error bin/bash: bad interpreter: No such file or directory

I am very new to bash and try writing the first script named hello_world in the path of /Users/me/Study/Linux with the content written by vim: #! bin/bash echo Hello World However, the error occurs ...
8
votes
1answer
2k views

Change output color of terminal (in Mac) to be different from typed text color

I know how to change the color of ls output, but I would like to change the color of all terminal output. To make clear what I mean, below is a picture of my terminal. My text color is orange. ...
0
votes
1answer
45 views

Click handler in Apple Script

I created a standalone macOS app using Script Editor. Upon starting, the app executes a bash script and upon quitting, the app executes another bash script. The code looks like this do shell script "...
0
votes
0answers
20 views

Open the official Apple Transporter app with params

I am looking for a way to automate the deploy of my React Native application built with Expo. I am using the transporter app (not Xcode) to upload my app to the apple store. echo '' echo '===========...
0
votes
0answers
9 views

`simctl spawn` results in “dyld: dyld_sim cannot be loaded in a restricted process” when trying to run an executable on iOS simulator?

I want to use the simctl utility to run any (native) iOS application, like /bin/sh or /usr/bin/uname on an iOS simulator. I have considered the simctl spawn command: $ xcrun simctl spawn Spawn a ...
1
vote
1answer
75 views

$PATH doesn't show .bash_profile, only shows /etc/paths

I have a beautifully set .bash_profile and everything was working well, then I updated to zsh. I installed Visual Studio for Mac, for a while I didn't realise that something was wrong, today I saw ...
4
votes
5answers
5k views

Shell command to count pages in a PDF (other than pdftk)?

I have been using this to get a page count of PDFs in shell scripts in OS X: pdftk "$i" dump_data | grep NumberOfPages | awk '{print $2}' | tr -dc '[0-9]' (where $i is the PDF filename) However, ...
1
vote
1answer
25 views

Terminal automatically opens conda [duplicate]

Every time I open my terminal I get (base) Users-MacBook-Air:~ Uriel$ instead of Users-MacBook-Air:~ Uriel$ without the (base) line which means that the environment of conda is open. In order to ...
3
votes
1answer
2k 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,...
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 ...
0
votes
1answer
24 views

Iterate over an array of image sizes, and move them to a new folder

So a few years ago a asked this question, on how to find an image of specific dimensions. That script worked (and works) great for me! But now, i want to find not just one (1) dimensions but 10 ...
-1
votes
1answer
54 views

Applescript: Get path of files copied to the clipboard

I like to get the paths of files that I have copied by using CMD+c in Finder programmatically. I.e.,: getPathOfClipboard.applescript # Should output the paths of the copied files in each line like ...
0
votes
1answer
36 views

Run Script Atomically

I have a launchd task that runs a bash script periodically, and this works great. However, if I change the script while the task is running, either by editing it directly, or swapping it with an ...
1
vote
1answer
28 views

How to organise overflowing config files and folders in the home directory and beyond!

The Context: I'm a long-time macOS user who has spent many years dabbling here and there with the *nix side of Apple life since the first iteration of OS X (10.0) originally shipped. Recently, I ...
0
votes
1answer
13 views

softwareupdate grep Script Help

Using High Sierra I have this set as a cronjob to run once a day. I've been struggling to work out how to get grep to find the string in the output. Am fairly new to bash scripting. Any advice on ...
1
vote
1answer
15 views

“File is Locked” message for a folder with thousands of subfolders/files

After transferring a massive code project to my Mac, I noticed I couldn't write anything to the files inside due to the "File is Locked" plus an access denied message. Unlocking the root folder didn'...
0
votes
1answer
35 views

How to reset my terminal prompt to default - post mess-up

Whether or not it was a mess up, this seems to be over my head, and further reading would only get me deeper in trouble. Hence am posting here: What happened (verbose b/c I am not sure which is ...
3
votes
3answers
8k views

Install John the Ripper Jumbo

I've been following the instructions here for installing John the Ripper on my Macbook Pro (El Capitan). I've skipped the Iterm and Cuda sections (I have a Redeon GPU). All is well until I run make ...
0
votes
0answers
22 views

Why is this PDF rescaling Automator script misfires?

I am using an Automator to convert folders of A4-sized PDFs to other formats. It uses PDF GhostScript though I have not personally written the code, somebody on discussions.apple.com helped me at the ...
0
votes
2answers
33 views

Determine Device for a File

In a shell script, I need to determine the device for a file, subsequent use with diskutil, eg... # ??? Assign device to FileDevice, based on full path. diskutil info $FileDevice
0
votes
1answer
68 views

Shell commands to determine if file is held on an APFS volume

In a shell script, I need to determine if a file is held on an AFPS volume. What is the easiest way to do that?
1
vote
2answers
517 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 ...
0
votes
1answer
30 views

Output folder contents to .CSV with alphabets removed from filename

I would like to turn the contents(filenames) of a folder into a .csv My problem is that the files are organised in sets. I only want to output the filename of each set without anything else but the ...
4
votes
3answers
2k views

Why is rename command missing from macOS?

I usually rename files and directories with the mv command. I'm reading a book on bash shell that mentions the rename command. When I executed man rename a man page was shown. However, when I entered ...
1
vote
1answer
24 views

pkgbuild open URL using default browser

I use pkgbuild to create an Apple installer .pkg. In my preinstall script, I have the following, which opens in Chrome if I invoke it myself, however when run by pkgbuild script, always opens the ...
0
votes
0answers
33 views

Shell script sleep timing is off when run from Automator

I have a shell script that plays a mantra and three bells for meditation. #!/bin/bash log=~/Dropbox/code/meditation/meditation.log bell_path=~/Dropbox/code/meditation/meditation_bell/ echo $(date) ...
3
votes
1answer
47 views

Closing Terminal window does not kill script run with sudo

X-posting from unix.SE on recommendation. I have a bash script called testing saved within /usr/local/bin. In one Terminal window in macOS I run sudo testing. In a second terminal window, I generate ...
0
votes
1answer
39 views

Installing Packages through Recovery Mode

Alright so at this moment my Mac only boots in recovery mode and I need to install a package (.pkg) before attempting to reinstall the OS. The package is located on a usb drive named "Package". I ...
0
votes
0answers
15 views

Why does launchd suddenly complain about error 78: Function Not Implemented? [long]

I have an old 2010 MBA which runs High Sierra. It is located at a condo which I visit for a few days each month. The machine runs 24/7 mostly to upload webcam photos to a host every four minutes, to ...
4
votes
1answer
49 views

How to add a terminfo entry systemwide?

I would like to add terminfo entries systemwide for rxvt-unicode and rxvt-unicode-256color. However, when I try to run: HOST:terms alexreinking$ ls rxvt-unicode rxvt-unicode-256color HOST:...
0
votes
1answer
89 views

The command for alias local='…' gets run on terminal open

I have an alias set up in my .bash_profile file: alias local='npm run start-local', and for whatever reason when I open a new terminal session it is trying to run that command npm run start-local ...
3
votes
5answers
7k views

Is there a way to list all available commands in terminal

Is there a way to list all available commands in terminal? I know linux has compgen -c is there an equivalent command for OS X? Update: The actual issue was that I was using zsh instead of bash. So ...
2
votes
2answers
268 views

Enabling /bin/bash on Catalina - invisible to System Preferences -> Security & Privacy -> Full Disk Access

I am having trouble enabling /bin/bash on Catalina - Macos 10.15.1 When I try to enable it using "System Preferences -> Security & Privacy -> Full Disk Access", the pop-up finder list doesn't ...
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
1answer
52 views

Difference in executing a command line in a different ways

Just so I understand the difference between executing the command line in Bash Terminal macOS Mojave. Let's take for example the installation of a package named: stackexchange.pkg What are the ...
0
votes
0answers
16 views

Modify/Wrap macOS System Plugin

I would really appreciate any advice on this. Introduction: I have both macOS Catalina and macOS High Sierra installed in my Mac. The former is on an APFS encrypted partition, and the latter is on ...
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 ...
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?
3
votes
1answer
308 views

sudo: setrlimit(8): Invalid argument after switching Mac OS shell from BASH to ZSH

After updating to Mac OS Catalina some months ago, I followed the prompted suggestions and changed my shell from BASH to ZSH. Since that time, whenever I use sudo in Terminal, I get sudo: setrlimit(8)...
10
votes
6answers
15k views

How to create an OSX Application to wrap a call to a shell script?

My goal is to include in a zip file what amounts to a shortcut, instead of telling my customer(s) to open up Terminal and run a shell script. My deployable essentially looks like this: $ unzip ...
0
votes
0answers
8 views

Can I write a script which caffeinates itself?

I have a couple of bash scripts which I almost always start and then walk away from my computer to let them do what they do unattended because of how long they take (and because they are often ...
1
vote
1answer
46 views

When should we enable the `locate` command on a Mac?

The locate command in Bash is available besides find to look for files, but it requires building a database. On a Mac, how useful is this and in what situation(s) should we enable it? $ locate '...
1
vote
2answers
3k views

Make Homebrew installed Vim override system installed one

I have troubling merging several version of vim on my machine. I have successfully installed vim via Homebrew. Here's the output of running brew info vim: vim: stable 8.1.1550 (bottled), HEAD Vi '...
1
vote
3answers
430 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
2 3 4 5
28