• Skip to primary navigation
  • Skip to main content

Ishan Sharma

Full Stack Engineer, Blogger, Student

  • Blog
  • WordPress Experts
  • Contact
  • About

Black Borders on Your External Display? Here’s the fix for macOS

Mac · January 14, 2018

Updates:

Before you the method in this post, try XG’s suggestion to restart in safe mode.

This method in this post requires trial and error if you have lot of displays. Konstantin Gredeskoul has created an automated bash script and shared it on GitHub. Check his comment.

Or directly go to GitHub for instructions: Changing OSX Underscan

I recently purchased an Asus external monitor. The first thing I noticed on plugging it to my MacBook was that there was a blank space at each of the edges. This wasted quite a bit of screen estate and also made everything blurry. This can generally happen due to wrong underscan/overscan settings.

On testing monitor with other laptops, I found that it was working fine. So it was something with my Mac. macOS has a slider to adjust overscan in system preferences. However, it only appears for TVs. So it was not appearing for me.

It took me two hours but I finally fixed it with help of command line and Stack Overflow.

The Stack Overflow question: “How to reload .com.apple.iokit.graphics underscan without restarting?”. This was unrelated to my problem but helped me to find the file where configuration is stored.

In case you encounter same issue, here’s a step by step guide to save you a couple of hours:

Disclaimer: You may damage your system with a wrong command, so proceed with caution. I am just sharing what worked for me and am not responsible for any loss or harm caused by anything in this post. It worked for me on a MacBook Pro (Retina, 13-inch, Early 2015) running macOS High Sierra (10.13.2), it may or may not work for you.

Fixing Overscan/Underscan

  1. Open terminal.
  2. You want to open /var/db/.com.apple.iokit.graphics file. To do that, enter following command in terminal:
    sudo open -a TextEdit /var/db/.com.apple.iokit.graphics
  3. TextEdit will open with the file. You’ll notice that the file has following structure:
  4. Starting with line 5, every key tag is a separate display and following dict is list of preferences for it.
  5. Note: You may need to do a bit of trial and error to find the correct display. In my case, I only use a limited number of displays, so I reset the settings for every display, restarted and it was fixed.
  6. Find the lines that say <key>pscn</key>. This is the preference that controls underscan/overscan.
  7. Next line after every pscn key will look like this: <integer>10000</integer> (line 34 above).
  8. 10000 means that there is no underscan. Value less than 10000 means that display will be underscanned, larger value means it is overscanned.
  9. For values less than 10000, change them back to 10000.
  10. Save the file, you may need to enter your admin password.
  11. Restart.

The issue should be fixed. I hope it will save some time for you. In meantime, if you find any shortcuts, do let me know via comments.

Share this:

  • Twitter
  • Facebook
  • Reddit
  • More
  • Email
  • Print
  • LinkedIn
  • Pocket
  • Pinterest
  • Tumblr

Filed Under: Mac Tagged With: macOS, Troubleshooting

Ishan

I am a Software Engineer and Writer. Interested in design, AI and drawing. When free, mostly found reading or gaming.

Reader Interactions

Comments

  1. Konstantin Gredeskoul says

    March 22, 2018 at 1:37 AM

    Ishan, thank you so much for posting this! It was a lifesaver for me, as I am forced to work on a very crappy Samsung monitor for a week that does not have any buttons, besides the power button LOL!

    I wanted to add one additional hint on how to determine which monitor is the the one that needs to be changed. Below commands are all run from the terminal:

    ? grep pscn /var/db/.com.apple.iokit.graphics | wc -l
    58

    This tells me that I had 58 monitor entries! How to tell which one is the crappy monitor I use?

    Here is what I did to figure this out:

    1) Make a backup of the current file:

    ? cp /var/db/.com.apple.iokit.graphics /tmp/.com.apple.iokit.graphics.backup

    2) With the “troubled” monitor connected, open DIsplay Preferences, and change it’s settings: for example, I changed it’s resolution from 1080p to 1080i. It doesn’t matter what you change, as long as you change something and specifically for that monitor.

    3) Run the “diff” command to see what had changed in that file after you made the changes:

    ? diff /var/db/.com.apple.iokit.graphics /tmp/.com.apple.iokit.graphics.backup
    195c195
    AAAAAAA….

    (I shortened the lines for readability). The only part we care about is shown on the very first line: 195. This is the line number where the change happened after you modified your monitor settings. In my case, the value for `pscn` was three lines above 195, i.e. at line 192.

    Now it’s time to follow your instructions, open the file in an editor, then scroll to line 192, then go up a few lines to find the `pscn` and edit it.

    Don’t forget to exit display settings before changing it, and then restart.

    Finally, I’ve tried to automate this process in a helpful script, documented here:
    https://github.com/pioneerworks/lib-bash#changing-osx-underscan-for-old-monitors

    Thanks again!

    Reply
    • Ishan says

      March 22, 2018 at 1:50 AM

      Wow. That script is amazing. Thank you for sharing this. I have added a note to top of the post about this.

      Reply
      • Konstantin Gredeskoul says

        March 22, 2018 at 2:31 AM

        You are welcome! I just extracted it so that it’s standalone and requires no dependencies:
        https://gist.github.com/kigster/7ce9e879883cf4899fa0de94a57dfaf0

        Thanks again!

        Reply
    • Dean says

      October 1, 2019 at 5:58 PM

      Thank you it worked. My file was locked so I had to save a copy to my desktop. Then I had to enable hidden files (I googled how to do that) and it showed the new copy on my desktop and the old copy on “open /var/db” so I replaced it and kept the original file name (had to change it form “copy” to “graphics” at the end. Restarted computer and it worked.

      Reply
  2. Pascal H. says

    April 26, 2018 at 11:59 AM

    Hi,

    I had the same problem and was able to fix it with the help of this post, So thank you !

    But I wish to put my 2 cents to this problem so I tried a few things and I maybe have a quicker solution…
    If you just delete the .com.apple.iokit.graphics file then restart Mac OS will create a new default one and voilà problem solved !

    Reply
    • Ishan says

      April 28, 2018 at 5:17 PM

      Hi Pascal,

      Thank you for sharing. In my case, I had tried deleting that file but that didn’t work for me.

      Reply
    • Munir says

      July 24, 2019 at 11:00 AM

      a year later…

      Thanks Ishan and Pascal, I deleted the file and it worked perfectly thanks, you guys are breathtaking!!!

      Reply
  3. gee says

    May 15, 2018 at 1:49 PM

    i typed “open -a TextEdit .com.apple.iokit.graphics” into terminal and it said the file does not exist.

    I tried searching for it on finder/spotlight trying several different keywords and phrases. I couldn’t find the file.

    could someone help?

    Reply
    • Ishan says

      May 16, 2018 at 6:25 PM

      Hi,

      The file is in /var/db, so either you need to use open -a TextEdit /var/db/.com.apple.iokit.graphics or use cd /var/db/ and then run the command I mentioned in step 2.

      Thanks.

      Reply
  4. Vinay P says

    June 8, 2018 at 1:40 PM

    Thanks Ishan, I tried a lot of troubleshooting and nothing worked, this was a big relief!

    Reply
  5. Paolo says

    July 1, 2018 at 9:32 PM

    Hello Ishan first of all thank you for this post.
    In my case (mac mini with High Sierra 10.13.5 monitor HP 2309m) the command open -a TextEdit /var/db/.com.apple.iokit.graphics do not allow me to edit the file even modifying the permissions.
    I tried with sudo open -a TextEdit /var/db/.com.apple.iokit.graphics but don’t works 🙁
    I resolved with the vi program
    sudo vi /var/db/.com.apple.iokit.graphics
    In my case just value is about 9500

    Wow! It works! Thanks a lot !!!
    By by
    Paolo

    Reply
    • Ishan says

      July 1, 2018 at 11:49 PM

      Thank you. Not really sure what would cause this. I included TextEdit because that’s generally easier to use for non-programmers (I had used Sublime Text).

      Glad that it worked for you.

      Reply
      • Slay says

        January 5, 2019 at 2:34 PM

        That’s because text edit can’t rewrite certain files, but vim can overwrite the original and leave it there in the same location which is what we want here in the first place

        This is the second time I had to fix the underscan. First time was for upgrading to sierra with my stock gpu that came with my mac pro 2010 dual 8 core. I followed the original instructions but I don’t think making a duplicate of the original and editing it and then replacing it fixed it because the .com is reserved and lock for the original…it took a couple of tries but it fixed it self from after a couple of restarts and safe boot..is what I think fixed it the first time.

        But this time I upgraded my GPU to a MSI rx560 and the underscan issue came back!!
        So I repeated the process instructed by your blog by duplicating the original .com.apple.iokit.graphics in text edit to rewrite and replaced it in the db folder but it didn’t work after two hours of trying, no luck I also tried nano by that didn’t work form….Then I used Vim and it worked!!!!

        Thanks for the tip Paolo…worked like a charm

        Reply
  6. Philipp says

    August 7, 2018 at 7:55 PM

    I have a Asus ProArt 329Q. I have tried your method but after a restart, the oscn value is always back to 1.
    If I set the resolution to 3840×[email protected], the top menu is cut off by about half its height.
    If I set the resoltuion to 3840×[email protected], it’s fine.
    If I hit the overscan checkmark (on), it disappears completely and reappears only after a restart. Weird stuff.

    Reply
    • Ishan says

      August 7, 2018 at 9:17 PM

      That’s some weird behavior. Unfortunately, I don’t have that monitor and am not really sure if there’s anything I can do to help here.

      Reply
  7. Phil says

    August 14, 2018 at 9:41 PM

    Hey, maybe you can help me. I tried, but I can’t edit the file because I don’t have the rights. I have an admin account macOS 10.13.6. I disabled SIP and changed all rights to read and write. But there is always the message that I can not edit the date, but only a copy of it. I’ve been looking for a way to use underscan on one of my monitors for ages. Any ideas?

    Reply
    • Ishan says

      August 21, 2018 at 8:35 AM

      You shouldn’t need to disable SIP. Does opening from terminal with sudo not work?

      Reply
  8. Kelvin says

    August 20, 2018 at 7:48 AM

    Hi I tried to access the file on my mac and it seems to say that the file is locked and i cant edit it and i cant seem to fine the file anywhere else as well… any advise on this issue?

    Reply
    • Ishan says

      August 21, 2018 at 8:35 AM

      Hi Kelvin,

      Did you try opening file from the terminal with sudo?

      Reply
      • Jack says

        August 25, 2018 at 9:00 AM

        My file is also locked… I obviously used sudo to force it, the document opens but I cant edit it. My mac wants me to duplicate the document instead of directly editing it.

        Reply
      • Vladimir Lopez says

        August 30, 2018 at 5:47 AM

        Hello, I have the exact same problem and I used sudo.

        Reply
        • Ishan says

          August 30, 2018 at 6:51 PM

          Can you try copying the file to desktop, removing the old file and then pasting new one in /var/db/? To open the hidden folder, just enter open /var/db/ in terminal.

          Reply
      • Leon says

        August 30, 2018 at 5:53 PM

        I have the same problem i opend it with the command
        sudo open -a TextEdit /var/db/.com.apple.iokit.graphics

        but it says its locked.
        what can i do?

        Reply
  9. Jack says

    August 25, 2018 at 9:00 AM

    My file is also locked… I obviously used sudo to force it, the document opens but I cant edit it. My mac wants me to duplicate the document instead of directly editing it.

    Reply
    • Ishan says

      August 30, 2018 at 6:51 PM

      Can you try copying the file to desktop, removing the old file and then pasting new one in /var/db/? To open the hidden folder, just enter open /var/db/ in terminal.

      Reply
  10. Leon says

    August 30, 2018 at 5:54 PM

    I have the same problem i opend it with the command
    sudo open -a TextEdit /var/db/.com.apple.iokit.graphics

    How to fix this?

    Reply
    • Ishan says

      August 30, 2018 at 6:52 PM

      Can you try copying the file to desktop, removing the old file and then pasting new one in /var/db/? To open the hidden folder, just enter open /var/db/ in terminal.

      Reply
      • Marvin says

        September 7, 2018 at 9:45 PM

        I have the same issue. I opened the hidden folder, but unfortunately the file is hidden too. Is there a way to show it and replace it?

        Reply
  11. Michele says

    September 3, 2018 at 3:57 PM

    I have the same problem. After typing open /var/db/ in terminal, in which folder exactly I have to remove the old file and replace it with the new one saved in desktop? Thanks!

    Reply
  12. Quinn says

    September 4, 2018 at 10:38 PM

    Hello!

    I am able to get it to work. However, every time that I turn my monitor off it requires that I repeat the full process even when the information is saved. Know of any fix for this? Thanks.

    Reply
  13. Jakub says

    September 28, 2018 at 3:41 AM

    You sir are the best.
    Thank you so much, I was gonna sell my screen after months of aggression towards it.

    I wish you all the good things in this world!

    Reply
  14. XG says

    October 27, 2018 at 3:52 AM

    Ran into this same underscan problem with black borders showing up on my new Dell 24-inch Ultrasharp U2415 connected to a 2013 Macbook Air running High Sierra, and after hours of looking into the problem the fix turned out to be super simple:

    Just restart in Safe Mode.

    That’s it. Restart your Mac in Safe Mode (restart, hold down the Shift key after the Apple BONG sounds, then restart normally once again for good measure. I don’t know what this clears or resets but it worked for me. No more letterboxing or black borders with the native 1920×1200 resolution selected.

    So maybe something to try first for anyone coming across this post.

    Reply
    • Ishan says

      October 29, 2018 at 11:08 PM

      Thanks for the comment and great suggestion. The post is a bit old so I don’t remember if I did start in safe mode (I think I did and it didn’t work), but I will add it to the post.

      Reply
    • viet thang nguyen says

      November 1, 2018 at 6:41 AM

      It worked! Just safe mode and restart! Thank you very much after a day of playing around…

      Reply
    • Kalyan says

      July 11, 2019 at 8:57 AM

      Hey XG,

      Many thanks!!!. I have restarted my 2017 Mac in safe mode. Lo and behold my DELL Monitor got filled completely without any Underscan issue.

      Thanks Ishan.

      BR,
      Kalyan

      Reply
  15. Thiago says

    December 13, 2018 at 12:15 AM

    Thank you very much for your post! It really helped me to solve my problem.
    I just had to perform a different step in changing the value on the file. I had to open the file with “nano” in order to modify it because using “textedit” was getting it locked.

    Reply
  16. Jinuk says

    January 17, 2019 at 3:03 PM

    Thank you so much for your post! It fixed underscan problem on my Dell U2713H.
    I was just need to disable the macOS’s system integrity protection (SIP) before editing the config file.

    Reply
  17. Nilan says

    February 16, 2019 at 1:35 PM

    how do you paste to /var/db/

    Reply
  18. chester.theCat says

    March 2, 2019 at 5:35 AM

    Thank you so much! You solved my problem!!!

    Reply
  19. Abhi says

    March 20, 2019 at 11:05 AM

    This post is a LIFE SAVER!!!! I’ve been going crazy for the last couple hours trying to fix this shit!

    Reply
  20. Christian says

    May 5, 2019 at 9:25 AM

    This seem to be really helpful to others. To me as well but it didn’t fix my underscan.
    This is what mine looks like (after some tinkering).
    I have noticed that I have “oscn” which means overscan, unlike yours, “pscn”.
    Never mind the 12000. Tried editing it, didn’t do anything. The only thing that seems to do anything was the oscn which can be either 1 or 2, yes or no. Just a toggle, can’t adjust.

    IOService:/AppleACPIPlatformExpert/[email protected]/AppleACPIPCI/[email protected],1/IOPP/[email protected]/NVDA,[email protected]/NVDA/display0/AppleDisplay-3674-30

    oscn
    0
    pscn
    12000
    startup-timing

    AAAAAAAAAMAAAAAAAAAAAAAAAAB4AAAAQgAAAAAAAACABwAAOAQAAAAAAAAA
    AAAAIO7ZCAAAAAAg7tkIAAAAACDu2QgAAAAAgAcAABgBAABYAAAALAAAADgE
    AAAtAAAABAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAA
    AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

    version
    2

    Reply
  21. Gaurav says

    May 31, 2019 at 2:28 AM

    Fantastic, this seems to works for me. Fingers crossed for now.

    Reply
  22. Ethan Z says

    June 29, 2019 at 7:31 PM

    Seems that using TextEdit on Mojave will fail saying the file isn’t owned by the user. Using Vim as superuser worked, however.

    Reply
  23. [email protected] says

    July 5, 2019 at 11:39 AM

    Thanks worked a treat dropping it down to about 8800. Ive some overscan now instead of underscan on my old 30inch Dell via HDMI but more than happy!

    Thanks so much

    Reply
  24. Andrew says

    August 9, 2019 at 6:43 AM

    Hey, thanks for this fix – it worked for me, although I used vi to edit the file.

    Why can’t Apple can’t just stick the underscan option in the display settings!

    Reply
  25. Maulik says

    September 12, 2019 at 2:05 AM

    oscn
    1

    I have this in my file when I make it 0 it’s underscan and 1 on overscan I tried 0.5 but it dint work so what should I do?

    Reply
  26. Khalid Ragi says

    November 11, 2019 at 7:35 AM

    Great solution, it helped me alot, I just used the file name to locate it in finder then deleted it and restarted my mac and all fixed.

    I opened my finder at root level by selecting locations and the MacBook if not shown just enable it from preferences-Sidebar then enable it from Locations
    press Command + Shift + Period this character . and navigate to var/db and find the .com.apple.iokit.graphics file and delete it after entering your password.

    Restart and Voilà.

    Reply
  27. cocoonkid says

    November 19, 2019 at 10:36 AM

    Wow!

    You guys saved my ass!

    sudo rm- rf /var/db/.com.apple.iokit.graphics
    reboot

    BAM!

    Reply

Leave a Reply to Jack Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2010-2019 Ishan Sharma

Copyright © 2019 · Maker Pro on Genesis Framework · WordPress · Log in

loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.