Date command does not follow Linux specifications (Mac OS X Lion)

This is because OSX and Linux use two different sets of tools. Linux uses the GNU version of the date command (hence, GNU/Linux). Remember that Linux is Linux and OS X is Unix. They’re different. You can install the GNU date command which is included in the “coreutils” package from MacPorts. It will be installed … Read more

Simulating mouse input programmatically in OS X

Yes, it is possible. You can use the Quartz Event Services to simulate input events. Assuming C, I wrote this quick example: #include <ApplicationServices/ApplicationServices.h> #include <unistd.h> int main() { // Move to 200×200 CGEventRef move1 = CGEventCreateMouseEvent( NULL, kCGEventMouseMoved, CGPointMake(200, 200), kCGMouseButtonLeft // ignored ); // Move to 250×250 CGEventRef move2 = CGEventCreateMouseEvent( NULL, kCGEventMouseMoved, … Read more

No such keg: /usr/local/Cellar/git

Give another go at force removing the brewed version of git brew uninstall –force git Then cleanup any older versions and clear the brew cache brew cleanup -s git Remove any dead symlinks brew cleanup –prune-prefix Then try reinstalling git brew install git If that doesn’t work, I’d remove that installation of Homebrew altogether and … Read more

sed -i command for in-place editing to work with both GNU sed and BSD/OSX

OS X sed handles the -i argument differently to the Linux version. You can generate a command that might “work” for both by adding -e in this way: # vv sed -i -e ‘s|\(.*\)\.o:|$(OBJ_DIR)/\1.o $(OBJ_DIR)/\1.d $(TEST_OBJ_DIR)/\1_utest.o:|’ $@ OS X sed -i interprets the next thing after the -i as a file extension for a backup … Read more

clock_gettime alternative in Mac OS X

After hours of perusing different answers, blogs, and headers, I found a portable way to get the current time: #include <time.h> #include <sys/time.h> #ifdef __MACH__ #include <mach/clock.h> #include <mach/mach.h> #endif struct timespec ts; #ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time clock_serv_t cclock; mach_timespec_t mts; host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); clock_get_time(cclock, &mts); mach_port_deallocate(mach_task_self(), cclock); … Read more

XAMPP permissions on Mac OS X?

Tried the above but the option to amend the permission was not available for the htdocs folder, My solution was: Open applications folder Locate XAMPP folder Right click, get info (as described above) In pop-up window locate the ‘sharing & permission’ section Click the ‘locked’ padlock symbol Enter admin password Change ‘Everyone’ permissions to read … Read more

Webview not displaying in MacOS using Delphi XE2

Getting the NSWindow of a FMX form convert a TForm reference to a NSWindow set Host Window. MyWebView.setHostWindow(MyNSWindow) procedure TForm2.Button1Click(Sender: TObject); var […] ObjTOC: TOCLocal; MyNSWindow : NSWindow; […] ObjTOC := (FmxHandleToObjC(Form2.Handle) as TOCLocal); MyNSWindow := NSWindow(TOCLocalAccess(ObjTOC).Super); PWebView := TWebView.Alloc.initWithFrame(MakeNSRect(10, 10, 300, 300), nil, nil); MyWebView := TWebView.Wrap(PWebView); MyWebView.setHostWindow(MyNSWindow); […] MyWebView.mainFrame.loadRequest(urlreq); end;

Homebrew brew doctor warning about /Library/Frameworks/Python.framework, even with brew’s Python installed

I also received this message. Something, sometime installed /Library/Frameworks/Python.framework on my machine (the folder date was about 4 years old). I’ve chosen to remove it. Please note that the Apple provided framework lives in /System/Library/Frameworks/Python.framework/