Mac

From rbachwiki
Revision as of 21:28, 8 August 2016 by Bacchas (talk | contribs)
Jump to navigation Jump to search

Reset Lost password

First up, you need to reboot your computer while holding the Command and the R keys down. Hold your Mac’s power button down for about six seconds, and it will turn off. Wait a couple of seconds more, and then hold down Command-R on your keyboard while pressing the power button again to turn the machine on. Keep holding the Command-R combination until you see the little spinning circle just below the Apple logo on the boot up screen.

Once your Mac boots, you’ll see a window with various options. Use your mouse to select Terminal from the Utilities menu, and Terminal will launch. Type in

resetpassword

and you’ll get a dialog box that will let you do just that. Choose the user you want to change the password for, and type in the new password twice. Hit OK, close the reset password window, and reboot your Mac.

Show Hidden Files in finder

defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
 
To set it back (that .DS_Store on the Desktop is hella irritating), execute those same commands, but just switch that TRUE to FALSE

Useful OX 10 Shortcuts

Task Key Command
Open the Force Quit window Command-Option-Escape
Cycle through active applications in the Dock Command-Tab
Cancel operation Command-.
Open Mac Help Command-?
Go back in the finder view to the previous item Command-[
Go to folder Command-~
Select all Command-A
Hide Finders toolbar Command-B
Copy Command-C
Duplicate; creates a duplicate copy of a selected items. Command-D
Turn Dock hiding on/off Command-Option-D
Move item to trash Command-Delete
Empty Trash Shift-Option-Delete
Eject the selected disk image, CD, etc. Command-E
Find Command-F
Hide application Command-H
Show info Command-I
Show view options in the Finder. Command-J
Connect to Server Command-K
Make alias Command-L
Minimize window Command-M
Minimize all open windows for an application Command-Option-M
Open a new Finder window Command-N
Create a new folder Command-Shift-N
Open file or folder Command-O
Print file Command-P
Quit application Command-Q
Show original Command-R
Add to Favorites Command-T
Paste Command-V
Close window Command-W
Close all windows Command-Option-W
Cut Command-X
Redo Command-Shift-Z
Go to Applications view in the Finder Command-Option-A
Go to Computer view in the Finder Command-Option-C
Go to Favorites view in the Finder Command-Option-F
Go to Home view in the Finder Command-Option-H
Go to iDisk view in Finder Command-Option-I
Take a screenshot of the entire display Command-Shift-3
Make and capture a rectangular selection of the display Command-Shift-4

Mac Terminal Commands only

ls -lah | pbcopy
will copy the output to the clipboard
screencapture
say "hello"
will speak hello
say -f filetoread.txt
will read contents of text file
say -f filetoread.txt -o audiofile.aiff
will output to an audio file
defaults write com.apple.finder AppleShowAllFiles -bool TRUE
Show . files in finder
defaults write com.apple.finder _FXShowPosixPathInTitle -bool TRUE
Display Unix path in Finder Windows
defaults write com.apple.screencapture type PNG
Modify Screen caputre type formats are PNG, BMP, GIF, JPED, PICT, PSD, SGI, TGA, TIFF
defaults write com.apple.screencaputre location "Users/robert/Desktop"
Modify screen capture location

Grep: searching with regular expressions

Grep Options (exmple: grep -Rl filename // will return filenames only
-i Case insensitive
-w Whole words
-v lines that don't match
-c return count
-n add line nunbers with search
-R search Directories Recursively
-Rl return only filenames
-RL Filename that do not match
--color=auto searchcriteria
ps aux | grep Applications // will return all running applicatiosn


Use Single User Mode to Solve Issues

Shutdown the Mac, wait 15 seconds

Hold down the Command and S Key While pressing the power button to start the mac.

At the Terminal prompt type,

fsck -yf

//filessytem check -y means asnswer yes to any questions  f means force

type reboot when finished

Apache, PHP, MySql setup on Mac

Check Apache Version: httpd -v

Check php Version: php -v

sudo apachectl start

sudo apachectl stop

sudo apachectl restart

Change directory where apache serves from

cd /etc/apache2/users

create a conf file, name it the log on user name

username.conf

<Directory "/Users/robert/Sites/">
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>

Save file
change permissions : sudo chmod 644 filename.conf
sudo apachectl restart
Upgrade Php to latest version

http://php-osx.liip.ch/

Edit PHP.ini to fix time zone; you have to modify two places

/usr/local/php5/lib/php.ini

/usr/local/php5/php.d

99-liip-developer.ini

Install MYSql

http://dev.mysql.com/downloads/mysql

dmg, 64 bit version

Add the mysql dir to your path

nano .bashrc ; add line below

export PATH="/usr/local/mysql/bin:$PATH"

set mysql password

mysqladmin -u root password

To change the password

mysqladmin -u root -p password

Restarting Apache in OSX

 Open Terminal, you have to have root access

type command;  apachectl restart

Turning on Root access in OSX

 Go to the Terminal:

Enter

sudo passwd root

and follow instructions

Mac OX 10 Directory Structure

File or Folder

Description

/.DS_Store

Contains Finder settings for the current directory. This folder is generated for any directory viewed in Finder.

/.Spotlight‐V100

Contains Spotlight‐specific metadata

/.Trashes

Contains files that have been dragged to the Trash

/.com.apple.timemachine.supported

Indicates that a drive can be used by Time Machine as a backup target

/.fseventsd

Used by the FSEvents API

/.hotfiles.btree

A B‐Tree index that provides fast access to frequently used files

/Applications

Holds all Mac OS X applications

/bin

Contains essential system binaries

/Desktop DB

Contains housekeeping information used by Finder

/Desktop DF

See /Desktop DB

/dev

Contains device‐specific files

/Developer

Contains Apple's XCode tools and documentation (but only if you've installed them)

/etc

Contains system configuration files. This is a symbolic link to /private/etc.

/home

Used by the automounter for NFS‐mounted home directories

/Installer Log File

Used by some third‐party installers

/Library

Contains support files for locally installed applications

/lost+found

Stores orphaned files discovered by fsck

/mach_kernel

Contains the Darwin kernel

/mach_kernel.ctfsys

Contains an alternate copy of the kernel (used by dtrace)

/net

Used by the automounter for NFS‐mounted directories

/Network

Contains network‐mounted Application, Library, and User folders

/opt

Contains the MacPorts installation (if installed)

/private

Contains the tmp, var, etc, and cores directories

/sbin

Contains executables for system administration and configuration

/sw

Contains the Fink installation (if installed)

/System

Contains various folders, the most important of which is Library, which holds support files for the system and system applications

/tmp

Holds temporary files. A symbolic link to /private/tmp.

/User Guides and Information

An alias to /Library/Documentation User Guides and Information

/Users

Contains home directories for users on the system (root user's home is /var/root)

/usr

Contains BSD UNIX applications and support files

/var

Contains frequently modified files, such as log files. Symbolic link to /private/var.

/Volumes

Contains all visible mounted file systems, including removable media and mounted disk images

Finding Php.ini File in OsX

The Php.ini is not necessary in OSX but if it exists it would be in the /Private/etc dir

Mac


Mac


Mac