All Questions
1,006
questions
0
votes
0
answers
41
views
Permission denied: users/usr/.local/bin
I'm trying to install a program to download pdf files. This is the github link https://github.com/Lofter1/anyflip-downloader. I followed the istructions but I basically don't know exaclty what I'm ...
1
vote
1
answer
54
views
Why I can't change the prompt in VSCode's terminal?
I am trying to change the prompt in my VSCode's terminal.
My OS is MacOS Monterey 12.6.
I use the zsh and I change the PS1 in .zprofile,such like this.
Then I use echo to test.The others can work ...
0
votes
0
answers
43
views
Connect to PEAP wifi network on mac with a shell script
I am making a shell script for my mac and part of it requires connecting to my school's wifi network.
I have tried both of the following commands and while the settings wifi tab says that the computer ...
0
votes
0
answers
77
views
How on MacOS from bash script (or installer) inform system restart is requried (which can be postoned by a user)
I have some post installation script which on some version of MacOS system does some system tweaks. This changes will take effect when system is restarted.
I do not want to restart machine immediately....
0
votes
1
answer
24
views
Use atrun via launchD on MacOS
I'm trying to schedule a job using the at-command in a script invoked by a launchDeamon.
This doesn't seem to work.
The launchD for atrun is running.
Atrun, cron and terminal all have full disk access....
0
votes
0
answers
118
views
Is there a best way to export from the Directory Utility?
I want to export all of the data from a page in the MacOS directory utility. In the edit section, it say's I'm looking at Users in node /Active Directory/XXXXX/All Domains. It lists all the users I ...
0
votes
1
answer
220
views
bash scripts not loading any of ~/.bash*
Context:
M1 MacBook
macOS Ventura 13.5.2
zsh as default shell
GNU coreutils installed by homebrew
/opt/homebrew/opt/coreutils/libexec/gnubin added to path in ~/.bashrc, ~/.bash_profile, and ~/....
1
vote
1
answer
280
views
How to execute three terminal scripts in three new tabs from Applescript?
I have the following apple script top execute three commands in different terminals. Is it possible to (1) combine this script to make it more efficient and (2) open in different terminal tabs instead ...
1
vote
2
answers
434
views
rsync - Operation not permitted when script is launched by cron
I've got a script that basically launches the following command
rsync -avh --progress --no-relative "$SOURCE_PATH/" "$DESTINATION_PATH"
and vice-versa (destination to source). ...
1
vote
1
answer
1k
views
How do I create a shell script that will exit the ssh session after executing the remote commands
I'm trying to write a bash script to compile and deploy some code to a remote server. So far I have been struggling to figure out how to get the script to exit the ssh session. I thought I could just ...
0
votes
0
answers
192
views
Deleting folders using rm -rf does not free up space
I am trying to re-install macOS on my iMac.
My iMac worked perfectly, before I upgraded macOS Ventura (It was a minor upgrade, I was already on Ventura). After I did a regular update, I logged into my ...
-1
votes
1
answer
415
views
Set Variable to ls command output
I'd like to create a variable from the output of a bash command. How does one create a variable out of the output of the command "ls /Users".
Variable creation does not work in this case:
...
1
vote
1
answer
174
views
Why does socat with rich terminal get killed with signal 9 on OSX?
I used the following command from this question to test out using socat to build a terminal with rich signals:
socat file:'/dev/tty',raw,echo=0 exec:'bash -li',pty,stderr,setsid,sigint,sane
On Linux, ...
0
votes
1
answer
454
views
macOS: pkill a specific process without sudo?
Because of some recent bluetooth issues, I need to be able to run sudo pkill bluetoothd quite frequently, so I decided to create a shell script Shortcut to have on my menu bar for quick access. I ...
0
votes
1
answer
658
views
Terminal search with output that excludes directories (as opposed to files within a directory)
I'm trying to do a recursive search in Terminal to find all files that are not folders; this is to confirm that a large directory structure has no content in it. Is there a way to do this?
Starting ...
0
votes
2
answers
489
views
Remove all characters in multiple filenames, that follow a specific character, in Mac OS
Trying to find a script, or app, that batch removes filename clutter following proper formatting.
For example this Exercise [2009] previous version.png into this Exercise [2009].png
I need the final ...
0
votes
0
answers
71
views
Unsetting bash function having name of executable prevents further use of executable
I created a function to enable me to run libreoffice from the command line (under MacOS):
libreoffice () { open -a libreoffice "$@"; }
Wanting access to the base functionality of libreoffice,...
0
votes
0
answers
62
views
/bin/ls -al --full-time does not recognize full-time in MacOS
I have 128,000 image file I recovered from a hard-drive failure. The software I used treated duplicates and deleted files the same way. ie it restored everything. As a result I have up to five ...
1
vote
0
answers
1k
views
.bashrc is not sourced when open new tab in Terminal.app
When I opened new tab in Terminal.app with cmd + T, .bashrc is not sourced automatically.
I had to manually run the source command.
Could you please tell me why this is?
environment
macOS Monterey 12....
2
votes
0
answers
61
views
Pipe stops unexpectedly
I'm running a script that does fine by itself, but stops when piped through less (or other program that grabs the tty). I've boiled it down to this snippet:
$ env -i TERM=vt100 bash --norc --...
0
votes
1
answer
536
views
BASH - combine .md files from subdirectories into a master .md
We have a growing list of subdirectories and we would like to summarize the content in each with a .txt or .md file. We would then like to consolidate those readmes into a single master readme. We ...
1
vote
1
answer
216
views
How can I fix a bunch of declare commands being spammed when I start a bash session? [duplicate]
Whenever I open a bash terminal, regardless of terminal client my output is spammed with a bunch of declare -x messages listing off various environment variables. Here's an example:
declare -x ...
1
vote
0
answers
2k
views
How do I mount a SMB folder in macOS via Terminal?
I have been working on a bash script to have systems mount a shared SMB folder(Windows Server) to a local folder /usr/local/Installers on macOS 12.
I can create the folders just fine en mass to 100 ...
0
votes
1
answer
2k
views
What is the difference between “base64 -b0” in macOS versions prior to macOS 13 (Ventura) and “base64 -i” in macOS 13 (Ventura)?
Up until I recently upgraded to macOS 13 (Ventura) I could run this Bash command to convert a JPEG image into a Base64 string in a script I occasionally use:
IMAGE_BASE64=$(base64 -b0 /path/to/image....
2
votes
0
answers
115
views
How to source from stdout for both Linux and macOS?
On Linux I can do:
source <(cat .env | grep ANDROID_GRADLE_TASK)
But on macOS, this doesn't do anything (no error, and no source)
What can I use for macOS?
Is there a command that works both on ...
0
votes
1
answer
697
views
"echo $VAR | base64 -di > file" fail to execute on MacOS
On Linux I can do:
echo ${ANDROID_KEYSTORE} | base64 -di > android/keystores/staging.keystore
But on MacOS, the same commands gives:
base64: option requires an argument -- i
Usage: base64 [-hvDd] ...
0
votes
0
answers
259
views
How do I make this ffmpeg command work on mac?
Works on Linux but I have a mac for work. I need to replace alsa and possibly x11grab so it works on MacOS:
screencap() {
file=`date +%Y-%m-%d-%H.%M.%S`
ffmpeg -f alsa -i pulse -f x11grab -...
0
votes
2
answers
20k
views
How to use ls command to show all the files including hidden files, but not showing the files named '.' and '..'
The working directories contains several subdirectories, and each subdirectory contains some hidden files that start with ..
How could I use the ls command to display all the files including the ...
0
votes
2
answers
746
views
How to programmatically disable OSX from charging?
How can we programatically disable OSX from charging when connected to power source?
And how can we programatically check the current battery percentage?
In order to extend battery life I'd like to ...
0
votes
1
answer
524
views
Two users (admin + non-admin) what is the right usage of su/sudo?
I have two users on a macos. U1 is a non-admin user and U2 is a admin user.
I cannot add U1 to the sudoers. Is there a way to use U2 to act as if it was U1 issuing sudo <command>?
My thinking:
...
0
votes
0
answers
145
views
mount command not working in a bash function
This is in MacOS 10.11.6
in the terminal using bash, I can issue the following command and it works perfectly.
mount -t $FILESYS //$USERNAME:$PASSWORD@$SERVER/$DSKLBL ~/$MOUNTPOINT
I can also include ...
2
votes
1
answer
3k
views
zshell says command not found in MacOS
I'm using MacOS Monterey 12.4. When I open zsh I get immediately
/etc/zshrc:7: command not found: locale
/etc/zshrc_Apple_Terminal:104: command not found: mkdir
I understand that my terminal ...
0
votes
2
answers
889
views
Find all files of name recursively, touch, and chmod all in one terminal command?
I am trying to run a single command to change all .DS_Store files within a directory and all subdirectories recursively.
So far, I have been using the following commands to find the files, set their ...
0
votes
1
answer
126
views
Set variable in Bash file by extracting text from another file
I am on macOS.
Here is my source file:
#!/bin/bash
version=42
o_ver=$version
let "version+=1"
echo Compiling version $version up from $o_ver
# . . . many more lines
I want to extract the ...
1
vote
1
answer
3k
views
run multiple npm script from another directories by writing only one command
I have application with frontend and backend folders. With structure like this.
application
├── frontend
│ └── src
│ └── build
│ └── package.json
└── backend
└── src
└── build
└── ...
0
votes
1
answer
229
views
which -a bash shows same path multiple times
When I check for bash installation I get multiple bash shown:
➜ ~ which -a bash
/bin/bash
/opt/homebrew/bin/bash
/bin/bash
Why is the same path shown twice? Is there a way to remove one of the /bin/...
0
votes
1
answer
334
views
Create desktop shortcut for Safari to a specific web - on MacOS
I'm trying to create a desktop shortcut for Safari that will lead to a specific website when the users will use it. Trying for hours but with no success. Can someone help please?
Thanks
1
vote
0
answers
1k
views
Is the macOS/Linux shell the same thing as Bash?
sorry if this is a silly question, but are there any differences between Bash and the macOS/Linux shell? (not all Linux distros use the Bash shell right?)
0
votes
1
answer
1k
views
Escaping quotation marks in a bash script on macOS
I want to turn the following command:
$ gdate --date='TZ="America/New_York" 1am' +"%a %F %H:%M %Z"
into a script using parameters, such as:
#!/usr/bin/env bash
gdate --date='TZ=&...
1
vote
0
answers
252
views
bash "find" command cannot search in ~/Documents folder on macOS
I am writing a bash script which shows all large files in your System.
I received an error message when i tried to find anything in ~/Library, ~/System, ~/.Trash and ~/Pictures but i also got one when ...
0
votes
0
answers
323
views
macOS terminal: show filename with colors when using grep
When using Ubuntu I get these colors when using grep (grep -r "MSP" .):
I want the same result when using macOS Monterey. I tried to add
export GREP_OPTIONS='--color=auto'
to my bash ...
0
votes
0
answers
14
views
aliases for terminal commands not loading on session start [duplicate]
my ~/.bashrc and ~/.zshrc both files have following aliases
# exa to ls
alias l='exa'
alias la='exa -a'
alias ll='exa -lah'
alias ls='exa --grid --color=auto --icons'
# bat alias to cat
alias cat='...
1
vote
0
answers
460
views
Unable to run Bash Script in Cronjob on Mac
Below script can execute from normal user but I can't able to run script through cronjob on macos(bigsur): Following error comes when script is executing through job security: ...
1
vote
0
answers
352
views
Terminal (zsh) prompt not showing up
I am using zsh on my Macbook, but sometimes out of nowhere the terminal prompt just doesn't show up when I launch it, and only restarting the computer fixes that. Any ideas about what could be causing ...
0
votes
0
answers
184
views
What is it in my .bash_profile that causes my terminal to open and shortly after read [process competed]
What is it in my .bash_profile that causes my terminal to open and shortly after read [process competed].
Here are the contents of the file:
#The original version is saved in .bash_profile.pysave
PATH=...
0
votes
2
answers
598
views
How to stdin a file from the clipboard on Terminal?
I'd like to replace my clipboard to its base64-encoded representation. One of my tasks includes to be able to pipe in a copied file into base64.
For copied texts I can simply do:
pbpaste | base64 | ...
3
votes
1
answer
1k
views
Filter stdin of process executed with socat client
My question is: is there a way to pre-process the stdin of a command executed via socat client.
Context:
I am launching a reverse shell with socat using this command:
$> socat -T30 "openssl-...
1
vote
1
answer
344
views
regex in find doesn't accept the or operator in group
I'm trying to delete all files and directories in a parent directory, with the exclusion of some directories and their content. For this I use find in a bash script on MacOS. It works if I exclude ...
0
votes
1
answer
118
views
Got daemonp error while installing doom
I am on Macos 10.14 and am trying to install Doom with Emacs.
I've downloaded emacs with brew install --cask emacs, and it is at version GNU Emacs 27.2.
I run the installation lines per doom's ...
1
vote
1
answer
2k
views
PATH still affected by Anaconda after uninstalling
When I run echo $PATH in terminal (macOS), it returns /opt/anaconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin. I have uninstalled anaconda and both my opt directory and .bash_profile are empty....