Questions tagged [bash]

The Unix shell formerly used by Terminal in macOS until 10.15

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

Terminal command ls/cd not opening external usb drive

I have a usb drive that I can access via Finder and rStudio but I cannot open the drive via Terminal to analyze its contents. I can see the usb drive name when I enter cd /Volumes && ls but ...
6
votes
1answer
2k views

Set file metadata attribute values

I'm trying to set the values of some file metadata attributes in OS X Yosemite - kMDItemDateAdded and kMDItemLastUsedDate - the values of which can be shown using mdls <filename>. I'm trying to ...
1
vote
2answers
64 views

bash does not honor ~/.inputrc

under the latest macos $ sw_vers ProductName: Mac OS X ProductVersion: 10.15.6 BuildVersion: 19G73 i am using the latest bash (installed via brew) $ $SHELL --version GNU bash, version 5.0.18(1)-...
0
votes
0answers
22 views

Error when trying to open PNG file with Preview from command line

I use a bash script to generate a PNG file. At the end the script opens the PNG file, but occasionally I get the following strange error message LSOpenURLsWithRole() failed with error -600 for the ...
0
votes
1answer
27 views

How to make an Apple Script use its local directory?

I am trying to bundle a .jar executable into an application using the solution provided here: How to create a .app folder from an executable .jar?. I deduced that main.script inside Contents -> ...
106
votes
9answers
453k views

How do I set environment variables on OS X?

I have always difficulties setting the Environment variables in OS X like JAVA_HOME, M2_HOME or PATH. How to set these on OS X Mavericks? I did some research but the answers I've found didn't really ...
1
vote
1answer
25 views

How do you open a specific folder in Finder without applescript?

Background I've replaced Finder as the default folder-opening app by editing ~/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist: <snip> { ...
1
vote
1answer
66 views

Make a sound in zsh when a command is not found

How can I get zsh to play a sound when the command is not found? Ex: I have the alias vpn to open my VPN from the terminal (zsh). If sometimes by mistake I type cpn instead of vpn, I get the following ...
0
votes
1answer
39 views

Terminal can't execute files In CWD

I stated having this behaviour recently when I tried executing my sh script via sh my_script.sh. It was a simple script with some pyinstaller command. Now, the issue that I'm having is that my ...
0
votes
0answers
28 views

How to run Applescript via bash from JAMF?

this apple script code works fine from the Script Editor app: tell application "Finder" to delete ((POSIX file "/Applications/Symantec Solutions/Symantec Endpoint Protection.app") ...
1
vote
0answers
39 views

Multiple Desktops/Spaces: Assign specific application windows to a specific Space programmatically?

I have seen existing questions (Assign Application Windows to Different Spaces/Desktops, Spaces in Mavericks: apps do not remember their space, How to have certain *windows* start in different spaces ...
2
votes
1answer
41 views

What is the actual difference between sh and bash?

Based on what I've read online, sh is essentially an alias for bash; running a shellscript with sh will behave the same as if it's run with bash. In my experience this is not entirely true, as ...
0
votes
1answer
64 views

How to create a script with Automator to watermark each PDF in a folder with a different watermark?

I am trying to create a script to watermark a group a PDF files in a folder, each PDF has to have a unique watermark. All the PDFs are in one folder, all the watermarks are in .png located in another ...
1
vote
1answer
23 views

LaunchAgents zip/tar not working in plist?

I created the plist for a 'custom' backup agent (via LaunchAgent). The (zip) program is called, but I keep getting a 'zip error: Nothing to do!' in my logs. I assume it has something todo with ...
0
votes
0answers
27 views

Using Packages to install and run homebrew

Using Packages to create an installer. The app depends on a package from brew. I added a install.sh to the pre-installation scripts section that has this: #!/bin/bash /bin/bash -c "$(curl -fsSL ...
1
vote
1answer
19 views

Empty output when using some shell commands via AppleScript's “do shell script”

AppleScript allows you to run shell commands with do shell script. It's easy to assign a variable to an output of such command. set theResult to do shell script "echo everything" >> ...
70
votes
17answers
54k views

How to get a notification when my commands are done

I'm running a series of commands on the command line that takes approximately twenty minutes to complete. I'd like to see some sort of notification on my Mac when these are finished so I don't need ...
2
votes
1answer
583 views

Big Sur switched to zsh terminal but still uses .bash_profile

I've upgraded to Big Sur and noticed my user was still using bash shell, so I changed Users → Advanced Options → Login shell to /bin/zsh and restarted. The shell that starts appears to be zsh insofar ...
4
votes
1answer
57 views

Same file reappears on Relocate Items after each macOS update

The following file keeps reappearing after each macOS update: /Users/Shared/Relocated\ Items/Configuration/private/etc/shells.system_default Ages ago I modified the file /etc/shells to add the latest ...
0
votes
1answer
36 views

How can I get SnailSvn to run a custom diff command?

How can I make SnailSvn use vimdiff or any custom diff script? It only has a predefined list of options. To setup its diff support (for opendiff aka FileMerge), it asks you to copy the following ...
53
votes
1answer
103k views

How to remove an environment variable on OSX using bash

I'm running under Snow Leopard 10.6.8 and I recently added an environment variable which it seems to be messing my bash terminal (I guess). What I did is add the variable DYLD_LIBRARY_PATH=/Library/...
19
votes
4answers
14k 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 ...
0
votes
0answers
21 views

bash (and others) do not receive ^O [duplicate]

Under Terminal.app and iTerm2, the key combination ^O is not received by many terminal programs. For example, /bin/bash does not receive ^O. Indeed, if /bin/bash could receive ^O, then ^V^O would ...
0
votes
1answer
31 views

Proliferation of unknown bash processes when invoking ps

I'm having some very strange behavior in my shell that I don't even begin to understand. I apologize for being somewhat lost, but I can't seem to turn up many obvious answers in a web search. I'm ...
0
votes
1answer
48 views

Folder name containing “..” on ExFAT: How to rename it? Invisible to ls/mv/Finder but visible to tar/bash

On an ExFAT disk, I have a folder that makes tar fail: $ ls -a . .. paysages scenes de rue $ tar cf /tmp/f.tar . tar: ./fruits, legumes,..: Cannot stat: No such file or directory tar:...
1
vote
1answer
116 views

crontab Operation not permitted - cron has full disk access

I have seen here various issues about the crontab 'Operation not permitted' issue for Mac OS, but I seem to have a more complex situation on my hands. I have a bash file on the desktop, which I wanna ...
4
votes
1answer
4k views

Terminal (bash) - copy files from Windows (SMB) shares without mounting

In past OSX versions, one could copy files from SMB shares like so: smbclient //my-server/foo -U USER%PASS -I 127.0.0.1 -c "get my.file" However, in recent versions, sbmclient has been replaced ...
0
votes
0answers
15 views

How to allow accessibility permissions from command line [duplicate]

I can give accessibility permissions to some programs by going in System Preferences -> Security & Privacy -> Accessibility, and manually adding the programs one by one. Is there a way to do ...
1
vote
1answer
54 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 ...
2
votes
1answer
48 views

iTerm2 : Adapting zshrc prompt to get the same one than with .bashrc

I switched from bash shell to zsh. After sourcing a main part of my old .bashrc to .zshrc, I am faced a problem concerning the rendering of prompt with zsh (which works with bash) : function ps1 { ...
1
vote
1answer
50 views

Adding Environment Variables

I can't understand the 3rd line in these instructions, found here Install dependency Ghostscript. On MacOSX: brew install ghostscript Create a symbolic link if you want to run it everywhere in bash ...
1
vote
0answers
108 views

Why do I have a folder with a question mark on my terminal title bar?

I've been trying to solve this for a few weeks now and the only thread I could find with this issue is this old thread which did not solve my issue. I've checked .bash_profile, .bashrc, .zshrc, ....
1
vote
0answers
25 views

How to automount an external drive to hold ~/LIbrary[/Developer[/CoreSimulator]]

Xcode simulators as usual multiples and expands turning ~/Library into a dumpster now on 256gb drive there is no space to install xcode 14.2 and i;m thinking to resolve the issue extensively buying an ...
0
votes
2answers
2k views

Access permissions for command file created with bash

I wrote myself a simple bash script which is a wrapper for compass create function, plus it creates a command file in the directory for compass watch (so that instead of manually typing out the ...
2
votes
1answer
76 views

How can I script moving files up one directory level with Terminal (or BBEdit worksheet)

When exporting from Photos.app with settings that preserve the album & folder structure, every album folder contains dated folders for every date represented in that album, with the actual images ...
1
vote
1answer
107 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 ...
1
vote
1answer
54 views

Creating an alias for Python in bash/zsh

I have often seen people recommending to setup an alias in one's .bash_profile or .zshrc along the lines of alias python='python3' This seems like a convenient idea, however, as far as I understand, ...
51
votes
3answers
34k views

How do I reset the scrollback in the terminal via a shell command?

When using Terminal.app, you can clear the screen by using the shell builtin clear or by pressing ^+L (Control-L). However, all this does is push the current screen content back one screen height ...
12
votes
4answers
17k 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 ...
-3
votes
2answers
74 views

How to get rid of phantom directories /Volumes on a Mac? [closed]

I have a couple of different problems with ls /Volumes. 1st, I have an AppleScript that could mount only 10 of my 13 volumes. The 3 I could not mount were named Data 1, Data 2, and Data 3. I renamed ...
2
votes
1answer
174 views

What is the exact equivalent of this netsh wlan add filter Windows command for Mac?

I want to block all networks from my PC with admin access and make it so that the user cannot reverse the changes. I will use admin access to only white list certain networks that will be visible to ...
1
vote
1answer
45 views

Updated Bash via Homebrew (from 5.0.17 to 5.0.18). Now I get Error message after starting Terminal

Updated Bash via Homebrew (from 5.0.17 to 5.0.18). Now I get this Error message after starting Terminal: [Command not found: /usr/local/Cellar/bash/5.0.17/bin/bash] [Could not create a new process ...
14
votes
4answers
7k 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 ...
8
votes
2answers
2k views

Default Bash 3 overriding shebang /bin/bash with brew installed bash 4

Background Bash 4 installed successfully using homebrew and the additional steps required to make bash 4 your default shell. Many guides on the net with a simple google: Example Bash 4 upgrade guide ...
1
vote
1answer
27 views

How should paths in /etc/paths.d get added to $PATH?

None of the paths I have in the /etc/paths.d directory are being added to $PATH in any of the shells on my High Sierra system. Presumably there’s supposed to be something in some file that says to ...
38
votes
6answers
123k 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
369 views

Shell command works fine as is, but not when executed from crontab. What's the difference?

I created a small workflow with the Automator App, and I want it executed periodically. For that I created an entry in crontab. The problem is that running the workflow straight from the Terminal ...
0
votes
0answers
20 views

How to run C# using Sublime Text3 build system on macOS?

I'm trying to run C# on Sublime Text 3 using a build-system config on macOS (with Command + B key combination). I've tried a few build systems: { "working_dir": "${folder:${...
4
votes
2answers
2k views

Why is wc -c printing spaces before the number?

command: echo "test" | wc -c results (7 leading spaces): " 5" I tested this on my linux box and I don't get the space in front of the five. is this a bug or expected behavior?
1
vote
0answers
20 views

Centrify: install using script in macOS 10.15

We were used to install Centrify using a simple script launched from KACE: sudo /usr/sbin/installer -pkg CentrifyDC-5.5.2-x86_64.pkg -target / Starting from Catalina, it seems that the script ...

1
2 3 4 5
31