Tag Info

New answers tagged

3

Here is an example In AppleScript using tron_jones's answer. The result of the command is set to _channel and then used in a dialog box just to show the result. Obviously _channel can be used in a variety of ways. set _channel to do shell script "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep 'channel:' ...


3

I would recommend using the "grep" and "awk" commands from bash. You can use them to parse the data given in bash. Here is example using the details you described above. /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep "channel" | awk '{print $2}' Do yourself a favor and sym link the binary to ...


2

The file cannot be removed even by root because it has schg and sappnd flag. Try this: $ sudo chflags 0 file.txt $ sudo rm file.txt The first line clears the flags.


0

I just installed the 10.10.4 update from Apple today. I noticed that the at command works. But that is not all you have to do to enable the service. What you have to do is to edit the /System/Library/LaunchDaemons/com.apple.atrun.plist and change the "true" to "false" after the disabled XML section. Then you can use command launchctl load ...


1

They are exactly the same. ⌘ CMD+. sends SIGINT just like ⌃ CTRL+c. I've checked this with this python script: #!/usr/bin/env python import signal import sys def signal_handler(signal, frame): print('You pressed Ctrl+C!') sys.exit(0) signal.signal(signal.SIGINT, signal_handler) print('Press Ctrl+C') signal.pause() It's made this way for backward ...


0

No there is no difference. They both send a SIGINT signal to the running process. You can demonstrate this using the code sample from this answer: http://stackoverflow.com/a/9256709/4087178


3

There is no evidence of any malware from the output of your discoveryd normally running daemon. Your pkill -f 6115 command failed because luckilly you don't have a process which full command name would be 6115. This is the sign of too fast reading the pkill documentation and not at all of an attack. If you really want to kill discoveryd here is the correct ...


1

Run the command you mentioned, then delete the plist. That's all there is to it.


2

TERM_PROGRAM is set by both Terminal and iTerm: TERM_PROGRAM=iTerm.app TERM_PROGRAM=Apple_Terminal


-2

Is it possible to actually update bash to version 4.0 in OSX Yosemite? Yes. Download / Install homebrew http://brew.sh/ by running this command in terminal. ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" Quit and reopen your terminal. then type brew install bash Change the default shell via the terminal gui ...


1

You will almost certainly be fine. Try pip install pip and it should tell you "Requirements already satisfied". You could also try pip show pip and it will tell you it is installed and requires no other packages.


5

man pbcopy pbcopy takes the standard input and places it in the specified pasteboard. If no pasteboard is specified, the general pasteboard will be used by default. The input is placed in the pasteboard as plain text data unless it begins with the Encapsulated PostScript (EPS) file header or the Rich Text Format (RTF) file header, in which case it is ...


1

Use cmd+r then open Terminal and type: resetpassword On the next window, click on the name of your volume (usually “Macintosh HD”), then select the troubled user account name from the drop-down. Skip the actual password fields (you are not changing the password). Click the button on the bottom section labeled “Reset Home Folder Permissions and ACLs.” ...


0

Resize your Terminal in Mac Preferences to fit your needs: Open Terminal with Spotlight (⌘space, enter 'Terminal') and open Preferences (⌘,). In the Window tab, look at the Window Size, Columns & Rows. The values are often 80 and 24. Optionally, resize your window to fix your desired new size. Pause and think, 24 lines, how wide is a line? OK, how many ...


2

First, you need to set your system name in System Preferences > Sharing > Computer Name. Let's assume for now that you set it to MyComputerName. The next step is to make sure your computer name is not overridden by DHCP client (which is normally what happens and what you have observed - each time a DHCP server assigns and IP address to your computer, your ...


2

You have to alter your path adding coreutils dir before /usr/bin. You can do something like this: export PATH=/usr/local/opt/coreutils/libexec/gnubin:$PATH And should looks like the following after the changes: /usr/local/opt/coreutils/libexec/gnubin:/usr/local/bin:/usr/bin: /opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin: ...


3

unbuffer is part of the expect package: brew install homebrew/dupes/expect You may need to: brew tap homebrew/dupes/expect Before you can install it.


1

A friend of mine found the answer for me. Apparently OS X has a function writeToFile:atomically, which causes a copy of the edited file to be made, then, on saving, replacing the original file with the copy. Since the copy exists in a different place in the hard disk, it has a different inode number. So after the save, the opened file points to a new ...


3

cd is a shell builtin, and has to be a builtin to work. If it were executed as a normal command, it'd run as a subprocess, change that subprocess's directory, and then exit... having no effect at all on the parent shell's directory. As for su: the fondamental distinction between /bin and /usr/bin is that /usr/bin might be on a different filesystem from the ...


0

You should look into icalbuddy http://hasseg.org/icalBuddy/ . This lets you configure what days you want to output, by date/calendar and all fields. It actually interacts great with calendars of all kinds (synced and not) and can be used in terminal, geektool, etc.


2

You can change the profile of an active window by doing the following: Right click in the open space of the Terminal window (or cmd+I) Choose "Show Inspector" Click on the "Settings" header in the Inspector window Choose a new profile for the current window


1

Assuming you’re not willing to give up your active terminal session, try to bootstrap your settings like this: export PATH=/bin:/usr/bin:/usr/local/bin; source ~/.bash_profile The part that says export PATH=… is there to bootstrap an environment for ~/.bash_profile, which might itself rely on one or more of the paths given.


0

grgarside and Jason Bush /usr/bin/defaults write \ /Library/Preferences/SystemConfiguration/com.apple.nat \ NAT -dict Enabled -int 0 Normally, the shell environment will have /usr/bin directory written down, so you only need to use (starting with sudo also helps): defaults write /Library/Preferences/SystemConfiguration/com.apple.nat NAT -dict ...


1

To open a certain link with Google Chrome, use this command in terminal: /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome 'http://example.com' --incognito Simply edit http://example.com to any other URL you want to use.


3

The current directory is usually not in the PATH variable (the variable contains all the directories where to look for an executable). If you type echo $PATH you will see that . is not in the semicolon separated list of directories.


-1

I encountered this problem in Yosemite 10.10.3. I couldn't find the solution until I started to think outside the box. Most people don’t know it, but as default the ”/private/etc” folder and ”/private/etc/hosts” file permissions are set to ”read only”. So if you only change the ”hosts” file permissions to ”read and write” you still won’t be able to edit it ...


1

Although Mark's answer is sufficient enough, just for the sake for providing an alternative you could open it with the default text editor via: /usr/bin/open ~/.bash_profile


-1

Open your .bash_profile, go to the line with your error command and put a # before it as first character of the line. Restart (to be sure).


7

Two easy options: Move your changes from .bashrc to .bash_profile (and delete .bashrc) Add a line source ~/.bashrc to ~/.bash_profile to make sure .bashrc is read during shell startup


0

Open /etc/profile and add the line PATH="" so it looks like this: if [ -x /usr/libexec/path_helper ]; then PATH="" eval `/usr/libexec/path_helper -s` fi


4

You can use the full path to the editors ( /usr/bin/emacs /usr/bin/vi or /usr/bin/nano) to edit ~/.bash_profile e.g. /usr/bin/emacs ~/.bash_profile


1

If you only have a few lines of output, you'd want to assign it to a variable and then display a confirmation dialog showing the output. add Action "Set Value of Variable" enter a new variable, e.g. output add Action "Ask for Confirmation" in the message field, enter the variable name declared above. While typing the variable name, Automator will suggest ...


0

The problem lies with usage of tcsh as underlying shell. tcsh does not support $() as a syntax for command substituion. When using bash instead, it works just fine.


2

From Homebrew issue #40735, what would the command "brew man cask" do? (which can be found by simply googling "brew man") brew man generates the Homebrew manpage from markdown, using these gems to do the translation.


0

Not a direct answer to your question, but have you looked at iTerm? It comes with several additional features on top of Terminal, and you can download and install a whole bunch of sweet themes on top of it. Apart from iTerm, I can also recommend zsh, which is just an additional layer on top of the bash shell, and if you use the oh-my-zsh plugin, again, you ...


0

See this answer on the Unix & Linux SE. There are a number of additional colors that can be used in a 256 color terminal. You can view the colors in Terminal, and see their codes, by running this bash script. (There is a also a color chart in the above linked post, or IMO a more readable chart here.) #!/bin/bash color=16; while [ $color -lt 245 ]; do ...


1

Let me correct my comment: A 64bit timestamp consist of access-modification-change-birthtime. From man 2 stat the following system calls change the respective times. The time-related fields of struct stat are as follows: st_atime Time when file data last accessed. Changed by the mknod(2), utimes(2) and read(2) system calls. st_mtime ...


0

If you want to see the monochrome Unicode characters instead of the graphic emoji ones, the only way to do it is to manually remove the font called Apple Color Emoji. However, if you do this you'll lose the graphic emojis in Messages, Mail, etc. You should still get the plain monochrome character in those apps.


1

defaults delete com.apple.mail DisableInlineAttachmentViewing


2

If you cd- change directory to the mounted filesystem then you must cd out of the filesystem before you can eject it. As an example cd; diskutil eject /Volumes/<volume name> cd: changes the current working directory to your home folder diskutil: ejects the filesystem


3

This should be solved changing the perms on that directory in the following way: $ cd /usr/local $ sudo chown -R <your-username>:<your-group-name> * If you don't know your group, just type id -g.


0

You have to use sudo to run the command with elevated priledges, like this: sudo chown -R `whoami` /usr/local


0

Thanks to the hint from @Zero, there is a way to Hide and Show individual files, including applications from Finder by using Terminal. To Show individual files: sudo chflags nohidden Mail.app/ To Hide individual files: sudo chflags hidden Mail.app/ Depending upon the file, you may not need to use sudo, but it won't hurt in any case (other than ...


0

cp ~/.bash_history ~/Documents/bash_history_`date \"+%Y-%m-%d-%H%M%S\"`.txt


1

It's not totally clear to me what you want, but if I understand correctly you want: to comfortably look through the history of used terminal commands selectively save them to a script for re-use To achieve 1 this answer already has an explanation. Objective 2 can be achieved by simply copy pasting the desired commands from the ~/.bash_history file. Or, ...


1

Maybe not quite what you're asking for, but an elegant solution: Press CTRL-R and it will invoke a search through your entire history. Pressing CTRL-R again will display the next search result. Another solution would be to use something like TextExpander etc. You define your commands there and call them by shortcuts. Unfortunately it doesn't work with the ...


3

Simply issue ifconfig List all network interfaces and their status.


2

The scutil --dns command gives you all the network routing information you'll need to map hardware interface labels to network routes. A little awk and grep can pretty it up if you need to script the information or pare it down. Start with gripping for "if_index" if you're curious.


6

I know you phrased the question in a way that makes me suspect you don't want to hear this answer, but you really should remove yourself from the sudoers file if you're prone to making the same mistake over and over. The underlying problem is you haven't aliased rm to be move to trash (which is clearly how you are using it currently and in the past) or ...


0

There are few 3d party application that can remap the keyboard to your liking. An example is the Karabiner. More simpler is if you just want to remap the control keys. That can be done in the system preferences- Keyboard.



Top 50 recent answers are included