Control+Shift+Eject for Macs with an Eject key
Control+Shift+Power for Macs without the eject key
Command+Shift+m: me/switch user
Command+Control+F: Toggle fullscreen.
Command+m: minimize window.
Command+Tilde: cycle through active windows in the current application. Much like Command+Tab.
Fn+Left = Home
Fn+Right = End
Fn+Up = Pg Up
Fn+Down = Pg Down
Command+A Go to Applications.
Command+D Go to Desktop.
Command+H Go to Home of current user.
Command+U Go to Utilities.
Other good shortcuts
Screenshot ROI: Command+Shift+4
Screenshot Window: Command+Shift+4 then SPC
Screenshot Screen: Command+Shift+3
Screenshot Window to clipboard: Command+Shift+Control+4
Darwin is an open-source Unix operating system released by Apple Inc. in 2000. It is composed of code developed by Apple, as well as code derived from NeXTSTEP, BSD, Mach, and other free software projects.
Darwin forms the core set of components upon which macOS (previously OS X and Mac OS X), iOS, watchOS, and tvOS are based.
FreeBSD is a free Unix-like operating system descended from AT&T UNIX via the Berkeley Software Distribution (BSD). Apple Inc.'s Mac OS X, with its Darwin base including a large amount of code derived from FreeBSD.
NetBSD is a freely redistributable, open source version of the Unix-derivative Berkeley Software Distribution (BSD) computer operating system. Due to its portability and quality of design and implementation, it is often used in embedded systems and as a starting point for the porting of other operating systems to new computer architectures.
OpenBSD is a Unix-like computer operating system descended from Berkeley Software Distribution (BSD), a Unix derivative developed at the University of California, Berkeley. It was forked from NetBSD in 1995. OpenBSD includes a number of security features absent or optional in other operating systems.
device's UDID must be in the provisioning profile built into the app by xcode.
device's UDID must not start with "fffffff..." (if it is, then it is fake).
you are building a Release version of your app.
the device is not behind an enterprise firewall preventing app installation.
You may also try to drag and drop the app into iTunes and sync your device: it will tell you if you app is valid or not.
If you are using a Development or Ad-hoc provisioning profile, your devices' UDIDs must be added to the provisioning profile used to sign your app. Only in-house builds (with an Enterprise Apple account) don't require UDIDs.
UDIDs are valid 40 hexadecimal characters ([0-9a-f]).
--- Disable Syncing
1. Make sure your iPod isn't connected to your Mac.
1. Launch iTunes, located at /Applications/.
1. From the iTunes menu, select Preferences.
1. Click the 'Devices' tab.
1. Place a check mark in the box labeled 'Prevent iPods and iPhones from syncing automatically.'
1. Click 'OK.'
--- Connect Your iPod or iPhone to Your Mac.
1. Quit iTunes, if it is running.
1. Make sure your iPod isn't connected to your Mac.
1. Hold down the option and command keys (Apple/cloverleaf) and plug your iPod into your Mac.
1. iTunes will launch and display a dialog box to inform you that it's running in "safe mode". You can release the option and command keys.
1. Click the 'Quit' button in the dialog box.
1. iTunes will quit. Your iPod will be mounted on your desktop, without any syncing between iTunes and your iPod.
# List process who is listening on 11113
lsof -n -i4TCP:11113
# -n: inhibits the name conversion.
# -i: selects the listing of files whose Internet address matches in the format [protocol][@hostname|hostaddr][:service|port].
Codesigning requires a certificate. The following procedure explains how to create one:
Start the Keychain Access application (in /Applications/Utilities/Keychain Access.app)
Select the Keychain Access -> Certificate Assistant -> Create a Certificate... menu
Choose a name for the new certificate (this procedure will use "gdb-cert" as an example)
Set "Identity Type" to "Self Signed Root"
Set "Certificate Type" to "Code Signing"
Activate the "Let me override defaults" option
Click several times on "Continue" until the "Specify a Location For The Certificate" screen appears, then set "Keychain" to "System"
Click on "Continue" until the certificate is created
Finally, in the view, double-click on the new certificate, and set "When using this certificate" to "Always Trust"
Exit the Keychain Access application and restart the computer (this is unfortunately required)
Once a certificate has been created, the debugger can be codesigned as follow. In a Terminal, run the following command...
codesign -f -s "gdb-cert" /path/to/gdb
If you don't want to codesign, then you have to use sudo for gdb.
Command line argument in Xcode
Product -> Edit Scheme... -> Run -> Arguments
The shortcut cmd + <
Global include header
The file "stdafx.h" will not be automatically included by all files. But we could import it in the PCH (mac Pre Compiled Header).
Mac not accept crt from GoDaddy?
Yes, the gd_bundle.crt provided by GoDaddy is not accepted by Mac OS. This page explains this and also provides a solution: replace it with a ca_bundle.crt, which is also issued by GoDaddy.
Keep wifi on when sleeping
Ref. In sleep mode, hardware will slow down or stop to work, so there is no solution for the question. The right workaround is to disable automatic sleep mode, and only sleep manually.
They are in ~/Pictures/iPhoto Library.photolibrary/Masters/. Use the following to mv all images out to DestPath. Reference.
We don't have wget on OS X, but curl is a good replacement - super fast too:
curl "http://127.0.0.1:8000" -o "outfile"
Copy file paths from Finder selections
The simplest way: Open text editor, ensure it is in plain text mode instead of HTML mode, make a new document, drag the seletec file(s) in Finder to the new document, and you will find the full path on that text.
Here comes the guru way - using applescript. Under Applications/Utilities, you will find the apple script editor. Copy the following codes into a new file, save it and it will be given a .scpt suffix. When you click Compile button in the editor, the scpt file will be replaced by a binary file, which is still openable by the editor.
tell application "Finder"
set sel to the selection as text
set the clipboard to POSIX path of sel
Then launch Automator, create a blank workflow, and then drag the Automator -> Run AppleScript (Utilities -> Run AppleScript in 10.5) action to the work area. Replace the stock AppleScript text with the three-line script you see above, then choose File -> Save as APP. Drag this app to dock.
When you need the path to an item, first select that item, then click on your program’s Dock, sidebar, or toolbar icon. Then switch to your target application and press Command-V to paste the path. See the page for reference.
I once tried to install MAMP on Mac OS, but visiting my customized documentRoot directory always gave "403 error", and the apache error log gave "no access to htaccess". I checked that the path hierarchy is executable and the files under the documentRoot directory are readable to all. I also ensured that in httpd.conf the directory configuration has the "Allow from all" line. Seeing the update issue of apache 2.2 to apache 2.4, I also tried to change that line to "Require all granted". No use.
In the end, I found that Mac OS has its own apache and PHP installed, so I quitted MAMP, edited /ect/apache2/httpd.conf (add an alias to my homepage and uncomment the php module line), and went to the command line "sudo apachectl start". Bingo! My homepage appeared! Conclusion: in Mac OS, the bundled Apache and PHP are enough, and using the 3rd party installation may incur trouble.
iOS has no swap, so the RAM is a scarcest resource.
How to switch between different wifi settings, such as I want to connect to wifi1 with DHCP while wifi2 with manually configured IPs? It is really annoying to manually set IP, Netmask and Routers every time when switching from DHCP.
I first tried with command ifconfig, but it doesn't work well together with the system Network config panel (or even conflicting with it). The recommended way is to set "Locations" in Network setting panel. See the detailed Howto here. To open, go: System Preferences - Network - Location.
Switch between tabs
Previous tab: Cmd+Shift+[, Cmd + Left
Next tab: Cmd+Shift+], Cmd + Right
split pane left-right: Cmd + d
split pane top-bottom: Cmd + Shift + d
next pane: Cmd + ]
previous pane: Cmd + [
input to all panes in current tab Cmd + Alt + i
open search bar: Cmd + f
find next: Cmd + g
clear buffer: Cmd + k
clear lines (Bash command): Ctrl + l
Zooming / Font Resize
toggle maximize window: Cmd + Alt + =
toggle full screen: Cmd + Enter
Add the dylibs to the product bundle. The following comes from Ref.
The issue is not where Xcode is looking for the library at compile time, which is what Simon Whitaker's answer addresses.
The issue is that the application which uses the dylib cannot find it at runtime. When an application is built that uses a dynamic library, it copies the install_name of the dylib into the output binary.
Creating a copy files phase and copying the dylib to the Frameworks subdirectory of the app's bundle is the right thing do do.
However, you need to do an additional step. You need to compile the dynamic library with an install_name appropriate for a bundle app. By default, a dynamic library is created with an install_name of /usr/local/lib. The app can't find your library there because it doesn't exist. Even if you put the library there, your users certainly won't have it, so that would be the wrong solution.
The right solution is bundling the library with the app. To set the install name for the dynamic library, go into the dynamic library project and set the "Dynamic Library Install Name" option to: @executable_path/../Frameworks/libmydynamiclibrary.dylib
Add the dylibs to standard paths. Standard include paths: ~/include, /usr/local/include and /usr/include. The standard locations for dynamic libraries are ~/lib, /usr/local/lib, and /usr/lib.
You may also place the .dylib file at a nonstandard location in your file system, but you must add that location to one of these environment variables: LD_LIBRARY_PATH (No default value), DYLD_LIBRARY_PATH (No default value), DYLD_FALLBACK_LIBRARY_PATH ($HOME/lib;/usr/local/lib;/usr/lib).
To find out which libraries a dynamic library depends on, use the otool -L library command.
If that's impossible, it is possible to edit what path is used using install_name_tool, but there are cases where this doesn't work, such as if the new path is longer than the old path and you didn't link it with -header_pad_max_install_names. Rebuilding with the correct path is preferred.
When the library name is a filename (that is, when it doesn't include directory names), the dynamic loader searches for the library in several locations until it finds it, in the following order:
The process's working directory
It is strongly recommeded to use "DYLD_FALLBACK_LIBRARY_PATH" instead of "DYLD_FALLBACK_LIBRARY_PATH" as in Ref.
When the library name contains at least one directory name, that is, when the name is a pathname (relative or fully qualified), the dynamic loader searches for the library in the following order:
$DYLD_LIBRARY_PATH using the filename
The given pathname
$DYLD_FALLBACK_LIBRARY_PATH using the filename
Collapse/unfold all methods/functions: command+alt+shift+←/→
Collapse/unfold all comments: command+ctrl+shift+←/→
Collapse/unfold current: command+alt+←/→
Go back/forward: command+ctrl+←/→
If you are accustomed to Visual Studio's #pragma region, you have a similar tool in Xcode:
#pragma mark - PublicAPI
#pragma mark - PrivateAPI
As of Xcode 4.x I've had to go to the Product menu, select "Edit Scheme", then select the arguments tab and add the arguments there.
I think the Xcode parenthesis hightlighting is not very good. Instead of moving cursor across the paren (only crossing the latter paren has an effect, but not when crossing the beginning one), I would like to double click one the paren and let show enclosing text.
XCode provides a so-called focus ribbon which locates on the left of the editor window, moving the pointer over it will show a focus window around current code snippet, which is Zehr Gute! See the IOS developer help page for this.