Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

View Power On Self-Test results via AppleScript System
After my lower memory slot failed, it took me quite some time to realize it. While the Mac does a Power On Self-Test of certain hardware, it gave me no notification that this slot had failed. It is possible to get to a report in System Profiler, but only if you launch the application and check it.

There is a command-line version of the System Profiler application called system_profiler. This utility takes optional data types as parameters, such as the the SPDiagnosticsDataType. I put this utility in a super-short Apple Script:
set post to do shell script¬
"/usr/sbin/system_profiler SPDiagnosticsDataType"

if post does not contain "Result: Passed" then
  display dialog post buttons {"OK"} with title "Error"¬
  with icon stop
end if
I then set this Apple Script as a Login Item and if everything goes well, I'll never see it. However, if the phrase 'Result: Passed' does not appear in the Power On Self-Test, a dialog will appear indicating what went wrong.

I've packaged the Apple Script into an app that can be downloaded from here

Please note that you will only see a dialog if the Power On Self-Test fails, so don't be surprised if nothing happens.

[kirkmc adds: The Power On Self-Test is described here. It is supposed to beep from one to five times, according to the type of anomaly it discovers. However, the poster pointed out that since he had RAM in both slots, the test did not beep for him. In most cases, therefore, the test should work as intended, but if you do have RAM in more than one slot, and it does not work, this script can help you find a (rare) problem. Note that you can also just run the command in Terminal should you be worried: system_profiler SPDiagnosticsDataType]
    •    
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[13,493 views]  

View Power On Self-Test results via AppleScript | 24 comments | Create New Account
Click here to return to the 'View Power On Self-Test results via AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
View Power On Self-Test results via AppleScript
Authored by: ryebrye on Apr 25, '06 09:55:25AM

If you check the "Diagnostics" part of the System Profiler, it will tell you the POST results.

Here are mine:
Power On Self-Test:

Last Run: 4/13/06 9:32 PM
Result: Passed



[ Reply to This | # ]
View Power On Self-Test results via AppleScript
Authored by: osxpounder on Apr 25, '06 12:14:53PM

Good to know, rye. Thanks! I can skip this startup script. I was wondering why, no matter where I snapped my new RAM chips in, the Mac seems not to recognize them. I was concerned I might have broken something, so being able to see these POST results might help me puzzle it out.

---
--
osxpounder



[ Reply to This | # ]
View Power On Self-Test results via AppleScript
Authored by: skippingrock on Apr 25, '06 10:43:11AM

Does the system keep a log of these such results?
I had a failure on my other PowerBook. I transferred the HD to this one, would like to see if anything was recorded in the logs that could let me know what the heck happened.

Cheers, SkipR



[ Reply to This | # ]
View Power On Self-Test results via AppleScript
Authored by: mr100percent on Apr 25, '06 03:35:37PM

Check the System.log and console.log files to see if they had any strange errors. I forget where they're located but your Console.app should have the location in the menu.



[ Reply to This | # ]
View Power On Self-Test results via AppleScript
Authored by: stop_a on Apr 25, '06 05:38:50PM
I ran into this same problem with my iMac about a month ago. I created a very similar script, which I compiled and enabled as a start-up item. The code:

set post_result to do shell script "/usr/sbin/system_profiler SPDiagnosticsDataType"

if "Passed" is in post_result then
	do shell script "/usr/bin/logger -p local0.notice 'post_check2 found no errors.'"
else
	display dialog post_result
	do shell script "/usr/bin/logger -p local0.alert 'post_check2 found POST errors.'"
end if
The differences: The logger command dumps a message into /var/log/messages, which I can check and see that it's running successfully. I also like having the POST results displayed right away if there's a problem. No need to go to system profiler to see them, just jump in and troubleshoot!

[ Reply to This | # ]
View Power On Self-Test results via AppleScript
Authored by: ppp on Apr 25, '06 07:02:53PM

My MacBook Pro does not respond to this command. No error, just no output. System Profiler reports "No Information Found" in the Diagnostics section. Perhaps the system_profiler command hasn't been updated to read this information from the new hardware.



[ Reply to This | # ]
View Power On Self-Test results via AppleScript
Authored by: mattcomi on Apr 25, '06 07:37:31PM

Indeed you can look at your POST results at any time by going to System Profiler, but if the error is non-fatal, (e.g. a failing RAM slot) why would you think to look? The point of using this script is to catch the kind of errors that would otherwise be swept under the carpet.

By the way, ppp, I noticed that behaviour on a colleagues Macbook Pro. I assumed that only his was doing that as it seems ludicrous that the POST was supposed to contain "No Information Found". I'm not sure what to do about that one, I guess we'll have to wait and see what a Macbook Pro does when something actually goes wrong ;)

Matt.


---
Big Bucket Amusement
http://members.iinet.net.au/~mattcomi/mt/bigbucket



[ Reply to This | # ]
only works on some Macs?
Authored by: xcgr on Apr 25, '06 08:52:39PM

On my PowerMac G4 Digital Audio, System Profiler -> Diagnostics displays: "No information found." /usr/sbin/system_profiler SPDiagnosticsDataType does nothing. I know my Mac passes POST because it chimes at startup. Does this only work on certain Mac models?



[ Reply to This | # ]
only works on some Macs?
Authored by: xcgr on Apr 25, '06 08:52:40PM

On my PowerMac G4 Digital Audio, System Profiler -> Diagnostics displays: "No information found." /usr/sbin/system_profiler SPDiagnosticsDataType does nothing. I know my Mac passes POST because it chimes at startup. Does this only work on certain Mac models?



[ Reply to This | # ]
View Power On Self-Test results via AppleScript
Authored by: markformac on Apr 25, '06 10:03:46PM

Doesn't the System Profiler's Diagnostics provide information regarding the self-test? If the self-test went okay, not revealing a memory slot-failure, than how would the System Profiler Diagnostics reveal something different?

---
Mark Brooks



[ Reply to This | # ]
View Power On Self-Test results via AppleScript
Authored by: mattcomi on Apr 25, '06 11:59:21PM

Almost, but like ryebrye posted, a successful result should look like:

Power On Self-Test:

Last Run: 4/13/06 9:32 PM
Result: Passed

---
Big Bucket Amusement
http://members.iinet.net.au/~mattcomi/mt/bigbucket



[ Reply to This | # ]
View Power On Self-Test results via AppleScript
Authored by: sjonke on Apr 26, '06 05:01:03AM
I read this tip and tried running it just for laughs and... was shocked to find that the last test run failed:

Diagnostics:

Power On Self-Test:

Last Run: 4/24/06 6:43 AM
Result: Failed
Failure type: Memory
Memory slot: SODIMM0/J25LOWER

I selected "About This Mac" from the Apple menu and, sure enough, it only listed 1 GB of RAM instead of 2! I had thought my AiBook seemed like it was a little slower, now I know why! Also, I did not hear any startup beeps, it just started up seemingly normally, although I think it might have taken a little longer. Anyway, thanks very much for posting this hint, otherwise I might never have noticed it!

I presume the above info means that the "lower" slot memory is bad (or, but I hope not, that the slot is bad), but which is the "lower" slot? Is it the one that is underneath the other, or is the one that is closer to the bottom of the case (which is on top of the other)?

---
--- What?

[ Reply to This | # ]

View Power On Self-Test results via AppleScript
Authored by: mattcomi on Apr 26, '06 06:51:10AM

Wow, well there you go.

Sorry to say, but that's exactly the same error I had, indicating that the lower memory SLOT was bad. Who knows though, it may should that error when it's just the RAM that's bad. Just try switching the chips themselves and see if it still complains about the lower slot.

And the lower slot is the bottom-most one. That is, the one that is underneath. Yknow.

Good luck!

Matt.

---
Big Bucket Amusement
http://members.iinet.net.au/~mattcomi/mt/bigbucket



[ Reply to This | # ]
View Power On Self-Test results via AppleScript
Authored by: markformac on Apr 26, '06 09:47:04AM

I understand what you are saying. But what I am trying to say is that if the System Profiler doesn't report a problem, then how is this script, which I guess works in sync with System Profiler's test results, show an error?

---
Mark Brooks



[ Reply to This | # ]
View Power On Self-Test results via AppleScript
Authored by: mattcomi on Apr 26, '06 06:53:17PM

Hi, not 100% sure I follow, but I'm pretty sure this will answer your question...

If the text, "Result: Passed" appears in the Power On Self Test, then the script simply exits, otherwise it displays a dialog containing the text that was returned.

Some people are reporting that their diagnostic result is "No information available". If there is no information available, the command line tool displays no text whatsoever. As the script uses the command line tool, it would, in that case, display a dialog containing no text.

Hope that answers your question.

Matt.

---
Big Bucket Amusement
http://members.iinet.net.au/~mattcomi/mt/bigbucket



[ Reply to This | # ]
View Power On Self-Test results via AppleScript
Authored by: markformac on Apr 26, '06 09:49:40AM

Are you saving this script as a run-only script or an application?

---
Mark Brooks



[ Reply to This | # ]
View Power On Self-Test results via AppleScript
Authored by: mattcomi on Apr 26, '06 07:33:55PM

The one downloadable from my site was compiled as an application.

Matt.

---
Big Bucket Amusement
http://members.iinet.net.au/~mattcomi/mt/bigbucket



[ Reply to This | # ]
View Power On Self-Test (and S.M.A.R.T.) results via AppleScript
Authored by: lynxie on Apr 26, '06 03:30:33PM
Now combine this with a script to check S.M.A.R.T. and it gets even better.
set post1 to do shell script ¬ 
"/usr/sbin/system_profiler SPDiagnosticsDataType" 
if post1 does not contain "Result: Passed" then 
display dialog post1 buttons {"OK"} with title ¬ 
"Error" with icon stop 
end if 

set post to do shell script "diskutil info disk0 | grep SMART" 
if post does not contain " SMART Status: Verified" then 
display dialog post buttons {"OK"} with title ¬ 
"Hard Disk Error!" with icon stop 
end if 


PS: I though I posted this as a reply yesterday but I was in a rush, so maybe I forgot to press the "Submit" button. Else

[ Reply to This | # ]
View Power On Self-Test (and S.M.A.R.T.) results via AppleScript
Authored by: lynxie on Apr 26, '06 03:31:27PM
Now combine this with a script to check S.M.A.R.T. and it gets even better.
set post1 to do shell script ¬ 
"/usr/sbin/system_profiler SPDiagnosticsDataType" 
if post1 does not contain "Result: Passed" then 
display dialog post1 buttons {"OK"} with title ¬ 
"Error" with icon stop 
end if 

set post to do shell script "diskutil info disk0 | grep SMART" 
if post does not contain " SMART Status: Verified" then 
display dialog post buttons {"OK"} with title ¬ 
"Hard Disk Error!" with icon stop 
end if 


PS: I though I posted this as a reply yesterday but I was in a rush, so maybe I forgot to press the "Submit" button. Else

[ Reply to This | # ]
View Power On Self-Test (and S.M.A.R.T.) results via AppleScript
Authored by: markformac on Apr 26, '06 11:15:51PM

I don't know anything about this type of scripting. Is there any way to only have a failed S.M.A.R.T. test alert you? Currently, even if the test passes, I receive the big red stop sign.

---
Mark Brooks



[ Reply to This | # ]
View Power On Self-Test (and S.M.A.R.T.) results via AppleScript
Authored by: lynxie on Apr 27, '06 07:11:01AM
Oops, I think that's because there is supposed to be a tab between "SMART Status:" and "Verified", it looks like the tab got stripped away somehow. But don't hold me to my word as I don't have a mac to test this right now. I'll reply with an updated version as soon as I get back to my mac. You can try to replace the fourth line from bottom with this (note the longer blank between status and verified):
if post does not contain " SMART Status:	Verified" then 
Sorry...

[ Reply to This | # ]
View Power On Self-Test (and S.M.A.R.T.) results via AppleScript
Authored by: lynxie on Apr 27, '06 01:57:23PM
Here we go, this seems to work well:
set post1 to do shell script ¬
	"/usr/sbin/system_profiler SPDiagnosticsDataType"
if post1 does not contain "Result: Passed" then
	display dialog post1 buttons {"OK"} with title ¬
		"Error" with icon stop
end if

set post to do shell script "diskutil info disk0 | grep SMART"
if post does not contain "Verified" then
	display dialog post buttons {"OK"} with title ¬
		"Hard Disk Error!" with icon stop
end if
Apologies for the previous mistakes and this long thread...

[ Reply to This | # ]
View Power On Self-Test (and S.M.A.R.T.) results via AppleScript
Authored by: markformac on Apr 27, '06 09:36:24PM

it worked as far as not receiving the stop sign for all S.M.A.R.T. tests. Only time will tell if it works for the error prompts. :)

---
Mark Brooks



[ Reply to This | # ]
View Power On Self-Test results via AppleScript
Authored by: n1mie on Apr 26, '06 06:47:29PM
When I run it on mine I get this result.
    Power On Self-Test:

      Last Run: 4/23/06 19:33
      Result: Failed
      Failure type: External cache
What does this mean to me and how can I fix it?

---
--Chip

[ Reply to This | # ]