Skip to main content

Questions tagged [bash]

The Unix shell which was the default shell in macOS until 10.15

Filter by
Sorted by
Tagged with
1 vote
0 answers
46 views

How to type tilde (~) in Spanish keyboard in Terminal

I type option+ñ and get a ~ on most applications: when I am in Terminal, I get (arg: 1) on bash, and ? on zsh. The results are the same for left and right option keys. Hardware: MacBook Pro, 15 inch, ...
simona's user avatar
  • 223
2 votes
2 answers
280 views

Newbie trying to write a simple script to automate command

Occasionally I have to clean up space by deleting older images and am doing this by manually going into various directories and doing this. I wanted to make a simple script to do this and have created ...
Martin Upton's user avatar
0 votes
0 answers
12 views

Allow every new AirPort network password access for my application

I made a CLI wifi that generates a QR-Code of the current wifi to connect with other devices. This CLI uses the next command: security find-generic-password -a "$NETWORK" -D 'AirPort network ...
Ulysse BN's user avatar
  • 107
0 votes
2 answers
91 views

Make backslash \ in terminal (Danish keyboard)

I am using a Danish keyboard language and Danish keyboard layout. When typing in my browser or other applications on my computer, I can make a backslash. In my case I use the combination shift + ...
morten's user avatar
  • 1
1 vote
2 answers
71 views

Bash, flatten a multilevel directrory while renaming files

I know this will sound slightly weird, but please bear with me. My car's infotainment system seems to have a limit on how many music directories and files it will acknowledge on a USB stick: It will ...
Dominic Strange's user avatar
1 vote
1 answer
84 views

Automator script error -212

Im on an intel macOS Catalina and I am trying to create a automation using apple script to run a command in zsh terminal. The command is to set new defaults for my bash profile and it works perfectly ...
pleasehelpme's user avatar
6 votes
3 answers
119 views

Can Bash case-insensitive matching for executables in $PATH be disabled?

Today I typed Grep by mistake in my Terminal and to my surprise, the /bin/grep command was executed anyway. I do NOT want this behavior. But, it seems it's not possible to disable it. I'm currently ...
luckman212's user avatar
  • 3,233
0 votes
2 answers
52 views

Bash / ZSH script that can be run as one click exe/app for other Mac users

I have a bash script and the only way I get others to run it is by sharing the code to them or asking them to open the terminal and then do "bash filename.sh". Instead of this, I would like ...
Drake's user avatar
  • 1
4 votes
0 answers
84 views

Shell script hangs when run with a shebang line

This didn't used to happen, but now when I try to execute a shell script in my path by name, it just hangs. The script: ~/bin/foo: #!/bin/sh echo this is foo My PATH: /usr/bin:/bin What happens ...
Edward Falk's user avatar
  • 1,033
0 votes
1 answer
76 views

Why does my script to copy folders fail?

I need to make a local copy of everything within the iCloud Drive folder. Here is what I have so far: #!/bin/bash #make archive folder is desired location mkdir /Users/username/iCloud\ Drive\ Archive ...
jdbj's user avatar
  • 9
16 votes
3 answers
10k views

I think I downloaded spyware! I used a curl command in terminal given by a fake support user to download a .sh file

I completely fell for a scammer helping me debug an issue. I ignored all the warnings until it was too late... I entered the below command in my macbook terminal and it downloaded a .sh file on my ...
Creole's user avatar
  • 161
-1 votes
1 answer
46 views

Issue with running SH file [closed]

I am trying to run the file run.sh with the command sh run.sh However, I get the error of permission being denied whether I use sudo or not. shloakagrawal@shloaks-air EaglerGradle-1.0 % sudo sh run.sh ...
Buddy Agrawal's user avatar
1 vote
1 answer
38 views

Make a login/logout script in mac [duplicate]

What would be the best way to log login, logout and the user that is logging into the mac? I have some machines which I control from remote desktop. I want to monitor who is logging into them and what ...
Saikat Karmakar's user avatar
1 vote
1 answer
53 views

zsh: To understand spaces

This is a one-line bash script by Ishmael Smyrnow to clear macOS icon cache: sudo rm -rfv /Library/Caches/com.apple.iconservices.store; sudo find /private/var/folders/ \( -name com.apple.dock....
user avatar
2 votes
2 answers
362 views

How do I restore a plist on another Mac?

I would like to transfer a configuration from one Mac to another using the defaults command within BASH. On one Mac, I can save the configuration by doing: defaults read edu.ucsd.cs.mmccrack.bibdesk &...
Jim L.'s user avatar
  • 540
5 votes
1 answer
1k views

Difference between cp and cp -rf

Could anybody explain is there any difference between cp some-file.txt some-folder and cp -rf some-file.txt some-folder on a Mac? I was told that cp -rf forces cp to overwrite existing files, but it ...
user avatar
2 votes
1 answer
77 views

How to move strings contained in results of `nettop` using text editor?

using sed, awk, ed, etc... how to save an output string into a variable and print in a different position? example output of nettop: iMac191 ~ nettop -l1 -n -J interface,state -p "$(/usr/bin/...
John's user avatar
  • 1,071
0 votes
2 answers
34 views

File with @ in permissions

I've done a bunch of searching and can't figure this out. I have a bash file I am trying to create and run, but the file keeps getting saved with an @ in the last position on the permissions: user@...
nihilon's user avatar
  • 135
2 votes
1 answer
280 views

Create auto alias of every folder in a specific folder in bash_profile or bash_alias

Using macOS Sonoma 14.2.1 We created an alias in .bash_profile or .zsh_profile and added the alias like this: alias dev='cd ~/Developer' Now there are many folders inside this and for each project I ...
xkeshav's user avatar
  • 245
0 votes
1 answer
51 views

Can't open multiple Finder windows from terminal

In iTerm running bash I run: open -a 'Finder' that correctly open Finder. Actually a window already existed so it just brings up that window. With this command I want to open another window even if ...
Leonardo's user avatar
  • 251
1 vote
2 answers
87 views

My terminal applications start bash, but no init files are getting sourced

This problem suddenly appeared out of nowhere and shows in both Terminal and iTerm2. When I start the apps, usually they would run my selected shell, whose path is configured as /opt/homebrew/bin/bash....
oarfish's user avatar
  • 1,992
1 vote
1 answer
201 views

iterm2 to honor /etc/paths with bash [duplicate]

I use Bash as my preferred shell, but the PATH values are different in my iterm2 and my Terminal (which honors my /etc/paths). How to have iterm2 to honor /etc/paths with the bash shell? More details: ...
xpt's user avatar
  • 405
0 votes
0 answers
84 views

Issues with zsh permissions on my mac m1

I am trying to install kubectl on my macOS using this link But in the final step when I go on to check 'kubectl version --client ', I get the error zsh: permission denied: kubectl I cannot understand ...
Elvis's user avatar
  • 1
0 votes
0 answers
190 views

Make zsh tab completion like bash

I don't have self-confidence in using term "completion". I just want to make zsh behavior like bash. (See uploaded gif) As this gif image shows, bash can complete path of the file by ...
xanadu6291's user avatar
1 vote
1 answer
50 views

Can't get shell script to talk to AppleTalk script in Automator

I'm trying to make an Automator Quick Action that will: Take a highlighted word, look it up in a database, allow the user to pick from among the hits returned by the database, and put the user's ...
Jan Steinman's user avatar
0 votes
1 answer
83 views

how to restore terminal commands?

I spent most of the day trying to install Ruby on my MacOs (from 2014, version 10.11.6 -- I can't update to higher). I finally got chruby installed with Homebrew and then tried to follow the ...
Michael 's user avatar
0 votes
0 answers
30 views

How to set the proxy variable in bash?

How to set the proxy variable in bash in macOS? I cannot install Homebrew, it gives the following error: curl: (60) SSL certificate problem: self signed certificate in certificate chain More details ...
Stephen's user avatar
3 votes
1 answer
3k views

In Mac OS Sonoma, 'Permission denied' when trying to create a file in the home directory

I'm on the latest Sonoma 14.2 and when in my user's home directory I cannot create a file. I have checked the rights and it looks okay. Sudo works but this is my home directory and it messes with me ...
fredrik's user avatar
  • 133
1 vote
2 answers
67 views

ctrl + w not deleting until the beginning of line in bash shell [duplicate]

the ctrl + w shortcut does not delete words until the beginning of the line, in bash shell; it gets stuck few characters before (ctrl + c would bring me to a normal new line) this is something weird I ...
jjrr's user avatar
  • 283
4 votes
1 answer
475 views

Why does iTerm no longer source ~/.bash_profile, but Mac Terminal does?

This must be something very simple, but I can't figure it out. Until recently iTerm always properly sourced .bash_profile which has: Sellotape:~ mnewman$ cat .bash_profile ## .bash_profile - Make sure ...
Buadhai's user avatar
  • 499
1 vote
0 answers
48 views

Having period job to remove temporary files

I've defined a periodic plist which runs a bash script. The plist is placed in the local library and script is also place in /usr/local/bin. It successfully run the script on the defined period but it ...
Parham Alvani's user avatar
3 votes
2 answers
184 views

Check if display sleep on Apple Silicon in Bash

I have a Bash script that performs certain actions when the Mac enters sleep mode. The script worked fine on my Mac with an Intel chip, but it can't detect whether it's sleeping or not with Apple ...
Piero's user avatar
  • 150
0 votes
0 answers
34 views

Cannot switch to root after applying Account Policies

After running the following script, that applies some Account Policies I have lost the access to root account. I took the script from Git Executing command sudo su - Resulting in request of an old ...
Papa Smurf's user avatar
9 votes
4 answers
3k views

Apple Terminal startup errors (session save/restore)

Recently (possibly with the Sonoma update, but possibly even more recently than 14.0), Apple Terminal has been giving the following error on startup (when macOS is set to restore windows, i.e., when ...
Andrew Jaffe's user avatar
1 vote
2 answers
146 views

Creating a FAT32 SD card image (.img) out of a directory using command-line tools

I'm writing a program which is meant to be loaded and run exclusively from a FAT32 SD card. I need to create an SD card image for distribution as well as for testing the storage and retrieval of files ...
AcinonX's user avatar
  • 113
1 vote
2 answers
398 views

How to add Google Chrome to path?

I want to add Google Chrome to path under the google-chrome name so that I can execute the following command: google-chrome --version. First I tried with: sudo ln -s /Applications/Google\ Chrome.app/...
mångata's user avatar
  • 111
0 votes
0 answers
148 views

How to fix bless command can't access efi-boot-device in MacOS Recovery Mode?

I run this command in Mac Recovery Mode via Terminal App -bash-3.2# bless --info Can't access "efi-boot-device" NVRAM variable
leeannecando's user avatar
0 votes
0 answers
43 views

How to access Finder's "Date Added" field from Terminal without MDLS

[MacOS Ventura] I need to move some files off a drive that is nearing its capacity to another drive while preserving the original Date Added in its new location. Since I've noticed that MacOS ...
gone's user avatar
  • 753
2 votes
0 answers
115 views

launchd job returning 2 but works fine in terminal

I'm trying to write a bash script to clean up my Downloads folder every day at a certain time. The bash script should get called then a python program afterwards to do the cleanup. I'm using launchd ...
A-A's user avatar
  • 21
2 votes
1 answer
251 views

sudo: command not found, despite path being set correctly

Recently, I've been unable to use the sudo command in terminal. Any command I try to give it, file I try to get it to run, etc, tells me sudo: [command or file]: command not found. If I try to run ...
GtwoK's user avatar
  • 121
1 vote
0 answers
154 views

Make a RTP-MIDI session in "Midi Network Setup" reconnect to a participant after reboot

In a studio setup, I need an RTP-Midi (AppleMidi) session, that is set up via "Audio MIDI Setup" to reinitiate with a participant, after reboot. At the moment, the Session is active but the ...
adrifromhh's user avatar
1 vote
0 answers
102 views

How can I run bash command with having Sandbox in Swift? [closed]

I made a working app which hides and shows the desktop icons using bash the terminal command for making it, easier to do this job with an UI, it works ok without sandbox and if there is sandbox it ...
bulletproof software engineer's user avatar
2 votes
1 answer
112 views

Possible diskutil info protocol fields?

Is there somewhere in the OS such as a plist that stores all the possible protocols for diskutil info? So far, I have come across the internal disks as PCI, SATA and PCI-Express. diskutil info /dev/...
Bob R's user avatar
  • 127
7 votes
3 answers
1k views

Terminal: How to move files to the last used directory conveniently?

I googled to no avail and could not find any example. For example, if I want to move files to the current dir I can use . But what if I am in ~/foo and cd into ~/foo/bar/xyz/dir and want to move, say, ...
mariano-daniel's user avatar
0 votes
0 answers
130 views

Display a Tooltip at Mouse Cursor (via Applescript or Shell Script)?

I tried googling for info about this for a while, but came up empty handed. Is there any way, either with shell or Apple script, or maybe even via python, to display a tooltip relative to the mouse ...
Max Well's user avatar
  • 279
0 votes
1 answer
77 views

Convert passwordLastSetTime to date format YYYY-MM-DD on macOS Monterey

The code below from Convert passwordLastSetTime to date format YYYY-MM-DD works great on macOS Ventura machines to convert the date for when the password was last set on a user account. But when using ...
MPL's user avatar
  • 57
2 votes
1 answer
177 views

Tilde expansion broken

Today tilde expansion has broken on my Mac. $ cd ~ -bash: cd: ~: No such file or directory I use vi-mode on zsh along with oh-my-zsh and thought that could be causing the issue. But switching ...
CalumMcCall's user avatar
0 votes
0 answers
80 views

Launch New Bash Shell And Run Commands

I am attempting to launch a new shell and run a command in the new shell, and then leave the shell running interactively. I attempted the process over here [ (bash --rcfile <(echo '. ~/.bashrc; ...
Justin Goldberg's user avatar
0 votes
0 answers
98 views

How do I trap in a bash script and guarantee execution?

I have a bash script like this #!/bin/sh function cleanup() { osascript -e "tell application \"Terminal\"" -e "set current settings of window 1 to settings set \"...
gman's user avatar
  • 2,941
0 votes
1 answer
81 views

Expected end of line but found "/"

I am updating a script that was written by someone previously in my position but it will not compile due to the error above. This is my first time using AppleScript, so I am very much a beginner. I ...
Connor Eddy's user avatar

1
2 3 4 5
37