Questions tagged [bash]

The Unix shell formerly used by Terminal in macOS until 10.15

Filter by
Sorted by
Tagged with
-3
votes
2answers
69 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
118 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
17 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 ...
0
votes
0answers
6 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:${...
1
vote
0answers
10 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 ...
0
votes
0answers
14 views

How use 'expect' to runing 'openconnect VPN' in background?

I'm a newbie to write bash script,I was using macOS catalina, and I write a bash script which use expect to run openconnect, #!/usr/bin/expect ... spawn sudo openconnect --user xxx --protocol=...
0
votes
0answers
9 views

lesspipe stopped colorizing

Recently, lesspipe (installed through brew) stopped colorizing output. I'm not sure what changed to make it so, as the problem seems to be with the output of file, and both file and lesspipe.sh were ...
1
vote
2answers
44 views

Cronjob macOS does not work if set with a bash external script

I'm trying to create a new cronjob which launches a script every time at startup. If I do cronjob -e and then I insert for example @reboot bash /Users/user/script.sh and then I save everything is fine:...
1
vote
1answer
28 views

“__git_ps1: command not found” from running “/usr/bin/env bash”

When I run $ /usr/bin/env bash (but not otherwise) I get the error: __git_ps1: command not found I've tried updating ~/.git-prompt.sh and ~/git-completion.bash for the version of git that I'm using. I'...
2
votes
2answers
302 views

Using launchd to clear bash history?

Clarification: Am not looking to destroy history, am looking for means to periodically purge it via launchd for security purposes Have been using cat /dev/null > ~/.bash_history to clear bash ...
1
vote
1answer
20 views

Every time I start my terminal, I get “.zshrc:source:18: no such file or directory: /sourceme.sh”?

I've been trying to download some softwares. I've deleted those files, but now, I think my zsh file keeps wanting to source a file that's no longer there. Because of that, I get the following message ...
1
vote
1answer
36 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 ...
0
votes
0answers
17 views

When I run a .command by double click, can I pass it its directory? [duplicate]

I have a bash script that I want to run when I double click it, so I've renamed my script.sh file to script.command. The script now gets executed when I double click it, but its working directory is ...
1
vote
0answers
18 views

Access text services via code

Is there a way to access text services such as these through either Applescript or terminal commands?
1
vote
0answers
52 views

Cannot install anything because of /usr/local/ permission

I'm using OS Catalina atm. I am trying to install Node and Homebrew but I can't seem to install anything because it keeps on saying I don't have permission in /usr/local/ Installing homebrew gives me ...
1
vote
1answer
45 views

How to return a list of all text editors via terminal?

Is there a way to return a list of all the installed text editors via the command line? I think (I can't test to confirm) this answer inadvertently gives the equivalent for ubuntu: sudo update-...
0
votes
0answers
37 views

Autochange TTL for Mac

I need to change TTL on my Mac, if I connect iPhone as a wi-fi modem. Now I am using this command: sudo sysctl -w net.inet.ip.ttl=65 Also I need to change TTL back to 64 when I connect to other wi-fi....
10
votes
6answers
2k views

Convert bash script to a compiled standalone binary executable, not text

I want to make a Bash script executable by the kernel. I have already used the chmod +x command and #!/bin/bash to make it executable and it works, but that I want to do is make it an executable ...
1
vote
1answer
37 views

How to switch the keyboard input language from the terminal?

I already have one way to do this: function input-switch-darwin() { cliclick kd:ctrl kp:space ku:ctrl } But this is very slow: ❯ time cliclick kd:ctrl kp:space ku:ctrl cliclick kd:ctrl kp:space ...
1
vote
2answers
67 views

Display Terminal message on login

I want to display something like ### this is a test ### when a new Terminal window is open (and ideally, in a way that can be disabled easily). On Linux this was straightforward; you'd create a script ...
1
vote
0answers
71 views

Install brew without prompt password

I want to create a script to automate the installation of brew on new workstations without entering password. In my /etc/sudoers I added the path to my file dsi ALL = (ALL) ALL dsi ALL = (root) ...
0
votes
1answer
71 views

Command line argument to “find” and “grep” data inside “xattr -l” atrributes?

I have a file that an application has set extended attributes for. $ xattr -l /Volumes/Educating\ Rita\ \(1983\)/Educating\ Rita\ \(1983\).1.eng.srt net.filebot.filename: 3_English.srt net.filebot....
1
vote
2answers
34 views

cron queueing bash and python scripts

I'm currently looking to understand and get comfortable with crontab queues on my macbook pro. I recently solved an issue where my simple bash script would not execute. It turns out I had to move my ...
0
votes
0answers
20 views

How to remap specific keys (insert, fn, etc.) usint hidutil

I have a computer that I cannot download much 3rd party software to (I'm not supposed to – long story, just accept it). This means, no Karabiner, etc. Further, the generic solution of "system ...
-1
votes
1answer
39 views

Duplicating and renaming images using script

I need to duplicate and rename an image using a list of SKU codes from a spreadsheet as the unique name for each image. I have used the script from this answer Automate Duplicating and Renaming Images....
1
vote
1answer
127 views

echo 'export PATH=“/usr/local/mysql/bin:$PATH”' >> ~/.bash_profile by using this command getting permission denied?

I tried to follow the instructions in How to add MySQL to $PATH variable to resolve "mysql: command not found"? $ echo 'export PATH="/usr/local/mysql/bin:$PATH"' >> ~/....
1
vote
1answer
23 views

Unable to run Bash 5 from launchd

I have the following launchd agent: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/...
2
votes
2answers
139 views

How can I convert this Bash prompt to zsh?

I have the following configuration for Bash: # Change Prompt # ------------------------------------------------------------ export PS1="...
0
votes
1answer
96 views

How to use script to open an app if it's not the front most app, and hide it when it is the front most app in macos?

I need a script to open an app if it's not the frontmost app and hide(command+h) it when it is the frontmost app. e.g 'Kim.app' how to write this in Applescript or shell script? Here is some info I ...
0
votes
0answers
71 views

Cannot find my Miniconda Python installation after switching from bash to zsh

Recently after upgrading to Catalina, the terminal changed from bash to zsh, and I lost my Python installation. My Python was installed with Miniconda, but now I can't find it anymore, I can only see ...
0
votes
0answers
42 views

Cannot backup Documents folder using LaunchAgent and bash

I use the open source borg backup tool to make a daily backup of my Documents folder which is also on iCloud drive. I use a LaunchAgent stored in my local library directory to execute a bash script ...
6
votes
2answers
666 views

$PATH vs. $path

I can't remember why, but a long time ago, I found that for some reason, I needed to set both of these variables. It caused no problems in bash, but now in zsh, when I put export PATH=~/bin:/opt/...
1
vote
1answer
96 views

cp from shell (Terminal) or Finder: “Operation not supported”

An odd issue here after an upgrade from High Sierra to Catalina. When I try to copy files from an SMB network share in the Terminal (bash and zsh), I get: $ cp /Volumes/share_name/path/file.ext ~/...
1
vote
1answer
31 views

Finder shows executable shell scripts as Unix binaries

I am writing and using many shell scripts (bash) on my mac. One issue has been bugging me for a while. When I look at the scripts in the Finder, they come up as "Unix Binaries". If I tag a ...
0
votes
2answers
42 views

A better usage of apropos for searching the man directory

I will ask my question starting from a real example. From the command line prompt, I want to search for a command line tool that will output information about my smart card. Side Note: I already know ...
1
vote
1answer
49 views

Any other Terminal / shell based options to strip all ACLs and extended attributes from a folder?

I'm having some trouble deleting some folders that contain nothing and have no processes or kexts utilizing them (lsof | grep path_element). When I try to delete them (as root) I get: root@hostname /#...
1
vote
0answers
31 views

How to write to iCloud in Terminal? (Currently seems read-only)

I have a bash function that writes to a markdown file. Here it is in its simplest form: function n() { echo $@ >> path/file.md; } This works fine. However, when I change the path to an ...
0
votes
0answers
27 views

How to disable special history editing on bash command line [duplicate]

The letter g at the end of a path entry in either Terminal or iTerm2 is being captured and processed - I think by bash. Here is what typing cd /git/ciderg looks like: Notice the g is not typed. If ...
2
votes
1answer
267 views

How can I set oh my zsh to be my default shell?

I'm using Hyper as my terminal application and I just installed Oh My Zsh via curl. I'd like it to be my default shell environment but for some reason whenever I restart Hyper I have to run the zsh ...
1
vote
1answer
45 views

How to execute this brew installed tool 'gigtools'

My goal is to to run this 'gigtools' folder which extracts and converts .gig [audio] files into .wav files. Website: https://command-not-found.com/gigextract So I've installed the commands with Xcode- ...
1
vote
0answers
46 views

Automatically run script on login (MacOS 10.15)

Because of a small disk I've got an external USB-C SSD drive where I want to move some software projects I'm currently no working on. To see the outsourced projects in my default projects directory in ...
7
votes
1answer
2k views

Why does ls -a not show files that finder does show?

When navigating to /usr/local/bin a file called "R" can be seen: But when cd /usr/local/bin and ls (or ls -a), we see a long list of files, but no file called R: I was surprised by this - ...
2
votes
0answers
779 views

How can I determine the source of this permission message? “bash“ wants access to control “System Events“

I occasionally receive this permissions message in MacOS 10.15.5: “bash“ wants access to control “System Events“. Allowing control will provide access to documents and data in “System Events“, and to ...
1
vote
5answers
411 views

How to identify the largest files in a directory including in its subdirectories?

I have a directory with a lot of files and subdirectories. I know there are a small number of large files contained somewhere within. What is a quick/easy way to identify one or more large files in a ...
0
votes
1answer
57 views

Handling permissions to run a bash script

I'm sending a bash script as a .command file to a friend. This person is not very tech savvy which is why I'm sending it in the first place, the goal is for the .command file to run through the shell ...
3
votes
1answer
47 views

Where should I place local executables on macOS? [duplicate]

I often write system-wide scripts and I wonder where to place my executables on macOS. On many Linux system, /usr/local/bin (also /usr/local/sbin) is usually empty and I place my executables in there. ...
1
vote
2answers
54 views

grep ^\. not working as expected in Mac terminal

if I run the following command in my mac terminal: ls -al | grep ^\. or ls -al | grep '^\.' or ls -al | grep "^\." I get no results back even though there are several files in my home ...
1
vote
1answer
55 views

How to modify the command line text showing in Mac terminal

My Macbook Pro shows a wired string ("ryoitasuou") at terminal like below picture. Does any know how to remove or modify it ? I already deleted the "ryoitasuou" folder in /Users ...
0
votes
1answer
28 views

Successfully launching a shell script from Finder when the path has a space in it

Been trying to work this out this morning and beginning to wonder if this is even possible. When launching a shell script through Finder, either by using the extension .command or opening .sh files in ...
0
votes
1answer
23 views

How to compress multiple folders into multiple zip files

My folder structure is: YEAR - MONTH - DAY - SUBFOLDERS I want to compress each subfolder in the [DAY] directories. The solution from here which is: for i in */; do zip -r "${i%/}.zip" &...

1
2 3 4 5
30