Mac Terminal Echo All Library Paths
Mar 03, 2017 I tried to import GPU Tensorflow; it failed to find the CUDA libraries. I checked the process.env environment variable and found that LDLIBRARYPATH and DYLDLIBRARYPATH had not been added. After further digging, I found that the shell-env package doesn't import them because it just calls the env command, which doesn't include them in its output for some reason. Apr 30, 2000 Setting PATH and LDLIBRARYPATH for the tcsh shell Setting PATH and LDLIBRARYPATH for the bash shell Type the following to see if /usr/local/bin is already in your path. On Mac OS X this file usually uses pathhelper to set PATH. This utility in turn reads the information from other system configuration files under /etc (see pathhelper manpage ). Note that even if you disable the reading of the initialization files by bash (e.g. With command-line options like -noprofile ) it will still inherit the environment of the parent process.
Welcome back to Coding Corner! Today, we're going to go over some great interface and user tweaks you can execute to customize your Mac. These tricks are often simple and can help you spruce up your Mac far beyond what the System Preferences window allows.
So, without further ado, 15 great tricks you can execute in Terminal.
Tweak the Finder
Want to see hidden files, or copy Quick Look text? There are quite a few 'defaults' commands that let you alter how the Finder looks or acts.
1. Show hidden files and folders
Want to see all the hidden files and folders OS X has to offer — or you simply can't find a file you hid? Just use this command in Terminal:
defaults write com.apple.finder AppleShowAllFiles -bool TRUE
killall Finder
To re-hide all your files, just change the TRUE
to FALSE
.
2. View any file's contents
If you've had a file get corrupted or you suspect there's something hidden inside its package, you can force Terminal to open it. Just use the following command:
cat ~/enter/file/path
Fair warning: If you try to open a photo or pretty much any non-text document, you'll likely just see text gibberish.
3. Copy the contents of a folder from one place to another
Sure, you can Option-drag any file to a new location to make a copy of it, but if you want to simplify the process and automatically copy the entire contents of one folder to another, check out this simple Terminal trick.
ditto -V ~/original/folder/ ~/new/folder/
4. Download files outside of your browser
Have the URL to a file but don't want to use Safari, Firefox, or Chrome to download it? You can go through Terminal with the following commands:
cd ~/Downloads/
curl -O http://www.thefilename.com/thefile/url.mp3
The first command moves your current Terminal location to your Downloads folder; the second downloads it from the web to that folder.
Modifying screenshots
Want to change how your screenshots look? Here are some commands to help you do just that.
5. Change your screenshot's file format
This Terminal command lets you change the file format of your screenshots. By default, they're saved as PNGs, but you can also save them as PDFs, JPGs, and more.
defaults write com.apple.screencapture type jpg
6. Disable drop shadows on a screenshot
Here's another good one if you tend to take a lot of screenshots: This command will disable drop-shadow on your screenshots, only displaying the window you've snapped.
$ defaults write com.apple.screencapture disable-shadow -bool TRUE
killall SystemUIServer
7. Create a new default name scheme for screenshots
Don't like the phrase Apple uses to save your screenshots? Traditionally, it's 'Screen Shot - [date] - [time]', but you can change 'Screen Shot' to any word you please.
defaults write com.apple.screencapture name 'New Screen Shot Name'
killall SystemUIServer`
Get bored of your new name scheme? Go back to the default by typing as follows:
defaults write com.apple.screencapture name '
killall SystemUIServer
8. Change the location of your screenshots
Your screenshots, by default, save to the Desktop. But if you'd prefer they save elsewhere, it's an easy Terminal trick to make it so.
defaults write com.apple.screencapture location ~/your/location/here
killall SystemUIServer
You can also drag the folder of your choice on top of the Terminal window after typing 'location' if you don't want to manually type out the file path.
System changes
If you're looking for broader OS X-level changes, these commands might help you get started.
9. Create a custom login message
Whether you want to troll your friends or add useful 'in case of loss' contact information, you can add a personalized message to your login screen with this Terminal command.
sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText 'In case of loss, call 555-555-5555.'
10. How long has my Mac been running?
Is your Mac acting sluggishly? It might be in need of a good restart. You can check to see just how long your Mac's been active by checking its uptime with this Terminal command:
uptime
11. Keep your Mac awake
If you need to prevent your Mac from going to sleep — say, you're running an extensive task, or recording your screen — there's an all-too-amusing command for that:
caffeinate
Once you enter this command, your Mac's digital eyes will be pried open and prevented from going to sleep until you end it by pressing Control-C.
If you don't want to rely on being the one to end your poor Mac's suffering, you can also create a set a number of seconds before your Mac sleeps:
caffeinate -u -t 5400
The above command will keep your Mac awake for an hour and a half.
12. Make your Mac automatically restart after a crash
We've all had our Mac freeze up or crash at least once in its lifetime. If you want to skip the crying and the yelling at the screen and get back to work, you can enter this Terminal command, which will make OS X reboot as soon as it senses a full system freeze.
sudo systemsetup -setrestartfreeze on
Modify your Dock
Want to make your Dock look different? Check out these Terminal tweaks.
13. Add spacers to your Dock
You can organize your Dock's many icons by adding in blank spaces with this handy terminal command:
defaults write com.apple.dock persistent-apps -array-add '{'tile-type'='spacer-tile';}'
killall Dock
Repeat this command for each spacer you'd like for your Dock. To remove a spacer, you can drag it out to the right until you see the poof icon.
14. Dull hidden apps in the Dock
Not sure which apps are visible on your screen? You can make this information extra pertinent by using this Terminal command, which lowers the opacity on icons for hidden apps in the Dock. It's a great way to see what you haven't used lately, as well as what's cluttering up your screen.
defaults write com.apple.Dock showhidden -bool TRUE
killall Dock
15. Hide non-active apps in your Dock
If lowering the opacity of hidden apps appeals to you, you might like this Terminal command even better: It hides any closed app from your Dock at all times.
defaults write com.apple.dock static-only -bool TRUE
killall Dock
Mac Echo Path
Your favorites?
Have a Terminal command you love that we didn't mention? Drop it below in the comments.
🍎 ❤️Apple reminds us all that 'creativity goes on' in new YouTube video
Apple's latest YouTube video knows just how to tug at the heartstrings.
I need to add dev tools (such as JDK and friends) to my PATH. How do I change $PATH variable in OS X 10.8.x? Where does $PATH get set in OS X 10.8 Mountain Lion?$PATH is nothing but an environment variable on Linux, OS X, Unix-like operating systems, and Microsoft Windows. You can specify a set of directories where executable programs are located using $PATH. The $PATH variable is specified as a list of directory names separated by colon (:) characters. To print the current settings, open the Terminal and then type:
OR
Sample outputs:
OS X: Change your PATH environment variable
You can add path to any one of the following method:
- $HOME/.bash_profile file using export syntax.
- /etc/paths.d directory.
Method #1: $HOME/.bash_profile file
The syntax is as follows:
In this example, add /usr/local/sbin/modemZapp/ directory to $PATH variable. Edit the file $HOME/.bash_profile, enter:vi $HOME/.bash_profile
ORvi ~/.bash_profile
Append the following export command:
Save and close the file. To apply changes immedialty enter:source $HOME/.bash_profile
OR. $HOME/.bash_profile
Finally, verify your new path settings, enter:echo $PATH
Sample outputs:
Method #2: /etc/paths.d directory
Apple recommends the path_helper tool to generate the PATH variable i.e. helper for constructing PATH environment variable. Open file location mac. From the man page:
The path_helper utility reads the contents of the files in the directories /etc/paths.d and /etc/manpaths.d and appends their contents to the PATH and MANPATH environment variables respectively.
(The MANPATH environment variable will not be modified unless it is already set in the environment.)
Files in these directories should contain one path element per line.
Prior to reading these directories, default PATH and MANPATH values are obtained from the files /etc/paths and /etc/manpaths respectively.
To list existing path, enter:ls -l /etc/paths.d/
Sample outputs:
You can use the cat command to see path settings in 40-XQuartz:cat /etc/paths.d/40-XQuartz
Sample outputs:
To set /usr/local/sbin/modemZapp to $PATH, enter:
OR use vi text editor as follows to create /etc/paths.d/zmodemapp file:sudo vi /etc/paths.d/zmodemapp
and append the following text:
Mac Terminal Prompt Full Path
Save and close the file. You need to reboot the system. Alternatively, you can close and reopen the Terminal app to see new $PATH changes.
Conclusion
- Use $HOME/.bash_profile file when you need to generate the PATH variable for a single user account.
- Use /etc/paths.d/ directory via the path_helper tool to generate the PATH variable for all user accounts on the system. This method only works on OS X Leopard and higher.
See also:
- Customize the bash shell environments from the Linux shell scripting wiki.
- Man pages – bash(1), path_helper(8)
Mac Terminal Echo All Library Paths 2017
ADVERTISEMENTS