New answers tagged terminal
0
votes
Determining if Low Power Mode is Enabled/Disabled from Command Line · macOS 12.2.1 (Monterey)
First note that while your picture looks correctly-entered, the line appearing in your question has "highpowermode" printed which, to my knowledge, is not one of the management settings ...
1
vote
/etc/sudoers is world writable and unable to change permissions on macOS M1
/etc/sudoers should be owned by root and have a group of wheel with 0440 permissions. To reinstate this, do:
osascript -e 'do shell script "chmod 0440 /etc/sudoers;chown root:wheel /etc/sudoers&...
1
vote
Accepted
Change terminal command prompt on macbook
The simple answer as to why the two pieces of code give different results is that they are written for two different languages. The first is bash which was the default shell on OSX 10.3 up to 10.14. ...
0
votes
Restoring Apple Mobile File Integrity back to default settings (nvram boot-args)
I was told I could do the following:
You can simply reset your nvram using the following terminal command:
sudo nvram -c
0
votes
Restoring Apple Mobile File Integrity back to default settings (nvram boot-args)
According to https://github.com/MacEnhance/MacForge/issues/30#issuecomment-604647302, this can be reset by running
sudo nvram boot-args=""
sudo defaults write /Library/Preferences/com.apple....
0
votes
How to clear "bell" flag (icon, sound) in Terminal tab?
Shell > Reset
This keeps it enabled, but clears the state.
1
vote
GDB Hangs after "New Thread" on macOS
This hang hits gdb bug: https://sourceware.org/bugzilla/show_bug.cgi?id=24069
You can install gdb from this source with patch:
brew install --force --build-from-source domq/gdb/gdb # a patched ...
1
vote
youtube-dl gives errors: "command not found"
Your homebrew setup is broken. Can you reinstall it and then run brew doctor?
Then you will test the YouTube-dl and possibly reinstall that.
Most of the time you don’t need to uninstall brew but the ...
2
votes
Mac daemon not able to run bash script
For anyone else struggling with fdautil (as I was), you need to set the command from the command line before it will work from launchcontrol.
For example:
sudo /usr/local/bin/fdautil set daemon LABEL /...
-1
votes
Every time I start my terminal, I get ".zshrc:source:18: no such file or directory: /sourceme.sh"?
The solution that worked for me is the following:
https://code.visualstudio.com/docs/supporting/faq#_resolving-shell-environment-fails
0
votes
Kali Linux on Macbook
It is possible to run Kali Linux in a virtual machine hypervisor, such as VirtualBox, VMware, and Parallels. However, in order to connect to network interfaces - since you have mentioned the desire to ...
0
votes
M1 mac: mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e') - python
Running the commands below resolved the problem for me:
arch -arm64e gem install nokogiri -v '1.13.6' --platform=ruby -- --use-system-libraries
bundle
-2
votes
My Mac has Python3 and 2.7 installed. How do I uninstall Python3 but keep 2.7?
If the python3 location is in /usr/bin/python3 then you won't be able to delete it directly, macOS may throw an error like “Operation not permitted” or “read only file system” etc, because macOS ...
2
votes
Accepted
How can I see all available params in the commands for Finder, Dock etc?
There's no command that will give you such a list.
There's also no published official documentation from Apple with such a list.
The defaults command essentially just writes some setting you indicate ...
-1
votes
M1 mac: mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e') - python
I got this when running an npm command that used compiled C packages. Solution was to run terminal in x86_64 mode and using node v14.x.x, as newer versions of node didn't work.
0
votes
Any way to change sound output device via Applescript or shell?
There is aloe a paid $5 app called Ears that will do the job and can be used with the command line https://retina.studio/ears/
3
votes
How do I view inline images in w3m?
From https://ilyakava.tumblr.com/post/616300103655948288/terminal-web-browser-with-images-macos:
First, you’ll have to use iTerm 3.3 or later.
Install the image converter for the terminal:
brew ...
0
votes
Automatic log each session from Terminal
There are two ways I am aware of:
Run all the commands you want in Terminal. Before closing the window go to Shell -> Export Text As... (or press CMD+S). This exports a text file with all the ...
0
votes
New iTerm2 Window Here option open two tabs
I found a solution that works, I left iTerm2 Settings > General > Startup as Use System Window Restoration Setting and also left Advanced > Enable session restoration on. I changed the ...
1
vote
Most homebrew installed commands outputs "zsh: killed"
The first two things I check is uptime and ps -ef | wc to make sure you don’t have runaway processes and the default limits. If the system is not healthy enough to run that, restart and if it still ...
5
votes
Accepted
How to use input variable in .zshrc alias?
From what I found, it is easier to use a shell function. You can simply define a function where $1 refers to the first argument given:
function mrc() { php artisan make:controller "$1" --...
1
vote
Shell command no longer working
Adding a leading slash before Users resolved this for me. Strangely this has worked for many years without issue so still puzzled as to why this stopped working. The AppleScript was simply just ...
1
vote
close all the instances of google chrome except first
you need set the number 100 as the count you need ( total app instance - 1 )
repeat 100 times
-- get list of open apps
tell application "System Events"
set allApps to displayed ...
0
votes
Cannot SSH into Cisco switch or pfSense router from Mac Mini (macOS High Sierra 10.13.6)
Another solution is to create ~/.ssh/config with -
HostkeyAlgorithms +ssh-dss
KexAlgorithms +diffie-hellman-group1-sha1
This way you won't need to do this every time.
1
vote
Terminal: run source ~/.bash_profile every time start new terminal
You can edit your environment in ~/.zprofile instead of ~/.bash_profile. Then, reopen a terminal.
-1
votes
'/usr/local/bin/curl' and '/usr/local/bin/ssh' commands are killed when executed in macOS Monterey
FWIW, I ran into the same problem after replacing an ancient 2012 Mac Pro server with an Apple Studio. It appears that macOS Monterey has new security "features" that make it impossible to ...
4
votes
Accepted
Open new application window via commandline
Add the following line to your ~/.zshrc file. (Or, your ~/.bashrc file, if you are using bash.) If the file does not exist, then create the file.
openwin() { osascript -e "tell application \"...
0
votes
Running the same commands on multiple remote hosts
If you have ssh access to all remote systems, you can run
for h in user@server1 user@server2 user@server3; do
echo "===== $h ====="
ssh "$h" sh -c 'cd /var/log/server; grep ...
0
votes
Running the same commands on multiple remote hosts
Using Alfred Clipboard History
This is a slight enhancement of the copy-paste option that relies on the Alfred app — Alfred is a launcher, providing a faster way to launch applications or perform ...
0
votes
Clear Terminal command history
Update 2022-05-05: For macOS 12 Monterey and above, you'll need to use this command to clear the Terminal history:
rm ~/.zsh_history
Alternatively, you can open your user folder in Finder, press ...
3
votes
Accepted
What are prerequisites for using perlbrew?
Apple's Xcode is not required to obtain the requisite components for perlbrew.
There is no need to be a registered Apple Developer to install the Command Line Tools (CLI) required for perlbrew. Simply ...
3
votes
How to export Time Machine exclusions or list them in Terminal
Here are 3 ways of getting Time Machines exclusions:
Firstly, every backup includes its own exclusion list. At the top level of each backup there is a hidden file called .exclusions.plist, for example ...
2
votes
In Terminal, using the "touch" command to mass create consecutive files with leading zero's, with bash, produces different results than zsh
Without installing a package manager and then a newer version of your shell, you could work with the tools you have. Using the builtin command printf you could-
touch $(printf "file_%02d.txt &...
1
vote
Accepted
In Terminal, using the "touch" command to mass create consecutive files with leading zero's, with bash, produces different results than zsh
The Bash version included with macOS is quite old (3.2.57 as of Monterey 12.3.1) and doesn't honor leading zeros when expanding {01..10}, but newer versions of Bash do (from man bash):
A sequence ...
0
votes
Accepted
You do not have permission to open the application “Anaconda-Navigator”
From the information here. The app is not in /Applications but is on a backupdrive.
I would undo the moves you made or reinstall the application
0
votes
Is it safe to use `trash-cli` on macOS?
As per the other answer there are ways that are much less complex that trash-cli, that is no need to much around with odd directories, so in your terms it is safer. They also can mark the trashed item ...
2
votes
Is it safe to use `trash-cli` on macOS?
I can't comment on the safety or security of that app except to say that it looks more complicated than others I've seen - and the one I use. There is a thread here on this subject that may prove ...
0
votes
How can I get accurate information about disk space used/available in Big Sur via the command line?
AppleScript can get the free space of a disk, which gives the same number as the Finder.
Open Script Editor and save the following script as ~/Library/Scripts/Free Space.scpt:
tell the application &...
0
votes
cal command - start monday
It is possible to install the same Linux version that comes with -m option for Mac through Homebrew, under the package util-linux.
$ brew install util-linux
It will be installed under /usr/local/opt/...
1
vote
Accepted
Error while disabling csrutil on macOS Catalina
You need to use the menu MacOS Post Install and run the patch "SIP disabler patch" with the GUI menu. The Terminal does not work on my Catalina (macOS 10.15.7).
1
vote
Accepted
What is '<<EOS' in shell commands like 'osascript <<EOS'
(Thanks to @red_menace, @fdo, and @nohillside so far. I've upvoted @red_menace's. It's "correct", but I found it difficult to grasp. I didn't really get it, until I read @fdo's link (first ...
1
vote
Error while disabling csrutil on macOS Catalina
You get into recovery mode with ⌘ Command R
Not ⌃ Control R
It will enter recovery mode and not just boot into macOS. You can then select Terminal from the "Utilities" menu (if I remember ...
0
votes
Is there a way to color parts of the man pages on the terminal?
man can do this on its with less.
You need to set the environment variable MANPAGER
I set it by
export MANPAGER="/usr/bin/less -R --use-color -Ddg -Du+y"
This works for zsh and bash
The -D ...
0
votes
Disable TimeMachine with AppleScript and Automator on Monterey?
A while back, I was having similar problems. I resorted to using this following AppleScript code to toggle "Back Up Automatically" to on or off.
if application "System Preferences"...
1
vote
Accepted
Is it possible to set a per-profile HISTFILE in iTerm2?
To do this, go to iTerm2 Preferences > Profiles > [Select "Work" Profile] > General > Command > Send text at start, and enter the following:
HISTFILE=~/.zsh_history_work
This ...
6
votes
What is '<<EOS' in shell commands like 'osascript <<EOS'
It is a here document (heredoc), and is built-in to several shells such as bash and zsh. The text between the delimiting identifiers (EOS in this case) is redirected to the command.
1
vote
Accepted
My PS1 Customized Terminal Prompt doesn't work on MacOS
I think you are complaining about 2 things.
The colours - that you alter in the Terminal preferences.
Not getting the arrow characters but a questionmark, The question mark in a box is placeholder ...
Top 50 recent answers are included
Related Tags
terminal × 5950macos × 2512
command-line × 989
bash × 929
finder × 369
applescript × 353
homebrew × 277
mac × 260
iterm × 249
ssh × 241
keyboard × 221
network × 197
zsh × 177
permission × 168
automator × 164
script × 162
macbook-pro × 158
unix × 149
catalina × 128
python × 127
path × 123
mojave × 114
disk-utility × 102
sudo × 99
hard-drive × 97