Questions tagged [bash]

The Unix shell formerly used by Terminal in macOS until 10.15

Filter by
Sorted by
Tagged with
1
vote
1answer
24 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 ...
0
votes
2answers
54 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 ...
5
votes
3answers
773 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 \...
0
votes
0answers
17 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
1answer
42 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
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
24 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 ...
1
vote
1answer
71 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 ...
1
vote
0answers
18 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 ...
-1
votes
1answer
53 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 ...
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
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
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
32 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
67 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?
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 ...
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
1answer
34 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
14 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 ...
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) ...
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-...
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
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 ...
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 ...
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
287 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)...
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 '...
0
votes
1answer
39 views

Creating a Service with automator, caffeinate

First of all, sorry for my english, not a native speaker. Since I'm a bit fed up opening Termninal and ^C I want to create a shortcut for activating caffeinate -d on my Mac OS X 10.11 I've been trying ...
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 ...
0
votes
1answer
44 views

How To Convert a Terminal Command into an “.app” file? [duplicate]

I want to run a command every-time I click an app icon. I want that app icon in my launcher or app drawer and dock. The Command I wanna run is this (posted here) open -na "Google Chrome" --args --...
4
votes
2answers
226 views

Auto start an application using a script

what I would like to do is a script which 1st checks whether a list of applications is running (e.g. Spotify, Thunderbird, Rocket Chat) and 2nd launch the apps from this list which are not already ...
1
vote
1answer
69 views

Run shell script by double clicking in non-login prompt in terminal

This question is super similar to this, but I'm curious how to launch the shell script in a non-login shell prompt. I already have it set up to run with iterm2 when I double-click. I don't really care ...
0
votes
0answers
83 views

High Sierra - Terminal “messed up”

After a re-installation of macOS High Sierra on my MacBook Pro, I realised that the Terminal is kind of "messed up" (random substrings of the Terminal's current output are produced) when resizing the ...
0
votes
0answers
19 views

Create image from the colorized terminal output

This will output a black and white image: git diff --staged . | convert label:@- diff.png but I want the color of the text (as the red & green is useful). I guess to configure the background ...
0
votes
1answer
57 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
36 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 ...
0
votes
1answer
19 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 ...
2
votes
2answers
92 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
106 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 ...
1
vote
1answer
74 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 ...
0
votes
0answers
11 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. ...
3
votes
1answer
105 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 ...
0
votes
0answers
34 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
75 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 ...
1
vote
0answers
47 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 ...

1
2 3 4 5
28