So i am lookin for some source code to crash the mac kernel. I found crashme for debain linux but that does not work for the mac kernel. So i was wondering if anyone knows where i can find a command-line utility or some source code to invoke the mac kernel panic? This would be a huge help, thanks.
Apple has a tech note about how to do this.
The short way to do it is with this command, sudo dtrace -w -n "BEGIN{ panic();}", run from the terminal.
Update 2020: As noted by Wei Shen in the comments, you'll need to disable SIP to make this work in modern versons of macOS.
I recently updated crashme to work on Mac OS X Lion. You will need to download the source code from http://crashme.codeplex.com/ and compile it using Xcode command line tools. More details are in a answer to question 5085136. But note that crashme hasn't found any immediate kernel panics on the Mac yet. However, after running crashme on the native MacBook Pro, and running it in VirtualBox VM's on the same machine, one in an x86 PC-BSD and another in an x64 Centos, my Lion Kernel became unhappy enough that it threw a kernel panic a few minutes later as I was editing a file using the native Emacs. So crashme may have stumbled upon a kernel bug.
Go in terminal and type "killall kernel_task" it should force the computer into a panic without downloading any software. Just make sure you have everything saved before you try :D
although this requires a password it works every time
sudo halt
Related
In attempting to install pkgin/pkgsrc (NetBSD-based package managment tools), using the saveosx.org instructions and github repository.
The repository has installation instructions, which I followed, up to the point of a specific but uninformative error:
It looks like there was an issue running: sudo /usr/pkg/bin/pkgin -y update
I tried running this file directly, but my terminal reports a segmentation fault.
I'm running OSX 10.7.5 and have Xcode-Command-Line Tools installed, but I find no information about Darwin version compatibility on NetBSD's site. My searches have revealed no one else reporting issues using pkgin.
Version 5.0+ is supported according to www.netbsd.org/docs/pkgsrc/platforms.html#darwin, which according to wikipedia (en.wikipedia.org/wiki/Darwin_%28operating_system%29#Release_history) corresponds to OSX 10.1.1+
What options do I have besides upgrading my operating system and hoping the problem is fixing by having newer libraries or a newer kernel?
For reference:
www.pkgsrc.org/#docs
www.perkin.org.uk/pages/pkgsrc-binary-packages-for-osx.html
wiki.netbsd.org/pkgsrc/pkgsrc_64bit_osx/
Related question: Unable to run pkgin on Mac OSX
It would appear that the pkgin binary currently supplied by saveosx is compiled only for more recent OSX releases. It needs at least a Darwin-14.x kernel, or newer, so it won't even run on 10.9.5. Unfortunately the script fails to check the OSX version before it blindly tries to run the pkgin binary, causing the program to crash.
saveosx is basically a painfully obnoxious, rather ugly, and poorly implemented. set of scripts that are superfluous to actually using pkgsrc on OSX.
I would strongly recommend avoiding saveosx for the time being.
Instead I would recommend trying the following well supported alternative:
OSX binary pkgsrc packages
A 32-bit Snow Leopard version that runs on 10.6.8 and newer is available, and I just checked the distribution directory and I see some 2015Q1 i386 packages are just now available, still supporting 10.6.8:
2015Q1 32-bit (i386) Snow Leopard and newer pkgsrc bootstrap
You can of course also build your own pkgsrc bootstrap for any specific OSX environment:
pkgsrc home
libCVD is a fairly standard library but when I try to build it using clang (the version that ships with XCode 5) it hangs on the target cvd_src/fast/fast_7_score.o
Has anybody else had experience with clang hanging on compilation or has been able to successfully build this library?
Compilation began hanging for me after upgrading to Mavericks.
Activity Monitor reported a high CPU usage for xcrun. My googling took me to this question, as well as to Xcode 4 Mavericks Creating Universal Binary for OSX hangs. I followed the advice given by user2965639 in the accepted answer for that question and I was able to compile again without any issue, so I thought perhaps this would be useful to share here as well. Here are the commands I ran:
sudo mv /usr/bin/lipo /usr/bin/lipo.orig
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo /usr/bin/lipo
Remove line OFLAGS=-O3 altogether in the Makefile generated by running ./configure_osx_32bit. That will get you past hang.
I have an old PowerPC Binary which runs on my system (Snow Leopard intel) using Rosetta. I wanted to debug the binary using GDB, however it tells me that it doesn't know how to run it. I think this may be because GDB only supports x86 binaries? I'm using the gdb which is supplied with the XCode environment supplied with the Mac OS X CD.
I searched and found one person with the same issue, but no answers. Do I have to install a special gdb?
gdb on OS X is actually a wrapper script which gives you options to run gdb itself under Rosetta.
Try something like gdb --translate --arch ppc .... (I don't have Rosetta installed here and don't want to install it, so I can't test it easily.)
The only sensible solution I could think about might be GDB for CW.
I doubt it is still worthwhile, though.
I am using MacBook Pro Mac OS 10.5 with related version of XCode. I am new to this development environment. I am learning macports, and I read information about macports from http://www.macports.org/. But I am still confused what macports is after reading information from this site.
I am previous working on Windows and Linux, could anyone let me know what macports is (in easy words) and what is the similar item on Windows/Linux?
thanks in avdance,
George
macports is a way of getting executables and other compiled code installed on your computer without having to work out the details of compiling/linking each apllication.
It is equivalent to a package manager under Linux and other Unicies. There is no direct equivalent under Windows.
It is just a convenient way to install a lot of *nix soft on your mac book. They are installed separately (not overwriting) from binaries/daemons/libs already installed on your mac (by default in folder /opl/local). Also they are much fresher than those installed on your mac.
For example 10.6 ships with bash 3.2, but after running sudo port install bash, you will get version 4.x (to make it your default shell add /opt/local/bin/bash to file /private/etc/shells, run chsh -s /opt/local/bin/bash and reopen terminal).
Note other os x package managers: fink and homebrew (superuser question)
I've just installed Ocaml on Mac OS X, and when I run the ocaml program I get a "Bus Error" with no other clues to what might be going on. Can anyone offer suggestions on where to go from here?
EDIT:
I installed via the package:
http://caml.inria.fr/pub/distrib/ocaml-3.10/ocaml-3.10.2-ppc.dmg
(I have an iBook G4, so PPC is appropriate)
To run ocaml, I just typed:
ocaml
in a terminal window
I also tried
/usr/local/bin/ocaml
and running from an xterm window. All three give:
Bus Error
I have Xcode and X11 installed as the README requires.
Turns out I was installing a version of OCaml built for Mac OS X 10.5.x (Leopard) on my machine running 10.4.x (Tiger). One would think it would be easy for the installer to catch this, but alas...
Did you install it from macports? It's working fine for me. Can you describe some more details about your installation? Perhaps what you're doing to get the error?