This problem has also troubled me for a few months, since I installed kodi-18.0-Leia_rc5.2-x86_64.dmg.
I tried upgrading but had the same problem with kodi-18.1-Leia-x86_64.dmg so I reverted back to kodi-18.0-Leia_rc5.2-x86_64.dmg, where I found the following fix.
Initially I encountered the problem with MacOS High Sierra installed, and it persisted after upgraded to Mojave.
I have since re-installed kodi-18.1-Leia-x86_64.dmg and verified that this fix also works with kodi-18.1-Leia-x86_64.dmg
Here are the details - I hope it helps someone, or that developers will take note and perhaps advise me if there is a better way to handle the problem than I have done.
-- PROBLEM DESCRIPTION
Kodi usually opens on the default display (iMac) when I have it configured to use SONY TV display.
This happens after quitting Kodi when opened from the task bar / Finder, either manually or by RemoteBuddy.
However, if I launch Kodi from the terminal, it opens correctly on SONY TV display.
Also, if I leave Kodi app running and log out or restart, Kodi also opens on correct SONY TV display.
-- MY SYSTEM (from kodi.log)
Running MacOS Mojave 10.14.3
With kodi-18.1-Leia-x86_64.dmg installed:
2019-03-12 14:58:37.100 T:4761925056 NOTICE: Starting Kodi (18.1 Git:20190217-8cfdc895f3). Platform: OS X x86 64-bit
2019-03-12 14:58:37.100 T:4761925056 NOTICE: Using Release Kodi x64 build
2019-03-12 14:58:37.100 T:4761925056 NOTICE: Kodi compiled 2019-02-17 by Clang 9.0.0 (clang-900.0.37) for OS X x86 64-bit version 10.9.0 (1090)
2019-03-12 14:58:37.101 T:4761925056 NOTICE: Running on Apple Inc. iMac14,2 with OS X 10.14.3, kernel: Darwin x86 64-bit version 18.2.0
2019-03-12 14:58:37.101 T:4761925056 NOTICE: FFmpeg version/source: 4.0.3-Kodi
2019-03-12 14:58:37.101 T:4761925056 NOTICE: Host CPU: Intel® Core i7-4771 CPU @ 3.50GHz, 8 cores available
With kodi-18.0-Leia_rc5.2-x86_64.dmg installed:
14:28:25.068 T:4687054272 NOTICE: Starting Kodi (18.0-RC5 Git:20190112-3cbd6c1eec). Platform: OS X x86 64-bit
14:28:25.068 T:4687054272 NOTICE: Using Release Kodi x64 build
14:28:25.068 T:4687054272 NOTICE: Kodi compiled 2019-01-12 by Clang 9.0.0 (clang-900.0.37) for OS X x86 64-bit version 10.9.0 (1090)
14:28:25.068 T:4687054272 NOTICE: Running on Apple Inc. iMac14,2 with OS X 10.14.3, kernel: Darwin x86 64-bit version 18.2.0
14:28:25.068 T:4687054272 NOTICE: FFmpeg version/source: 4.0.3-Kodi
14:28:25.068 T:4687054272 NOTICE: Host CPU: Intel® Core i7-4771 CPU @ 3.50GHz, 8 cores available
-- MY RESEARCH
I tried setting environmental variables so that perhaps I could edit one of Kodi .plist files to force it to always use SONY TV display.
However, Apple seems to have changed the method of setting environmental variables over time.
The latest info I have on setting environmental variables is:
Edit /etc/launchd.conf
I tried the following method but it didn't work, even after restart:
https://www.dowdandassociates.com/blog/c...chd-plist/
>HowTo: Set an Environment Variable in Mac OS X - launchd.plist
I also failed to find any useful, current method in a general search:
https://duckduckgo.com/?q=Kodi+set+envir...fnt&ia=web
So, next, I enabled debug logging in Kodi and restarted to try and find out what the running Kodi app environment looked like: display names that might be useful in forcing it to use SONY TV.
Here is part of what I found:
>13:17:47.223 T:123145569652736 DEBUG: Thread ActiveAE start, auto delete: false
13:17:47.223 T:123145570189312 DEBUG: Thread AESink start, auto delete: false
13:17:47.247 T:123145569652736 NOTICE: Found 1 Lists of Devices
13:17:47.247 T:123145569652736 NOTICE: Enumerated DARWINOSX devices:
13:17:47.247 T:123145569652736 NOTICE: Device 1
13:17:47.247 T:123145569652736 NOTICE: m_deviceName : default
:13:17:47.247 T:123145569652736 NOTICE: m_displayName : Default
13:17:47.247 T:123145569652736 NOTICE: m_displayNameExtra: HDMI
13:17:47.247 T:123145569652736 NOTICE: m_deviceType : AE_DEVTYPE_HDMI
13:17:47.247 T:123145569652736 NOTICE: m_channels : FL, FR
13:17:47.247 T:123145569652736 NOTICE: m_sampleRates : 48000,44100,32000
13:17:47.247 T:123145569652736 NOTICE: m_dataFormats : AE_FMT_S24LE3,AE_FMT_S24NE3,AE_FMT_S16LE,AE_FMT_S16NE
13:17:47.247 T:123145569652736 NOTICE: m_streamTypes : STREAM_TYPE_AC3,STREAM_TYPE_DTS_512,STREAM_TYPE_DTS_1024,STREAM_TYPE_DTS_2048,STREAM_TYPE_DTSHD_CORE
13:17:47.247 T:123145569652736 NOTICE: Device 2
13:17:47.248 T:123145569652736 NOTICE: m_deviceName : Built-in Output-50
tream0
13:17:47.248 T:123145569652736 NOTICE: m_displayName : Built-in Output
13:17:47.248 T:123145569652736 NOTICE: m_displayNameExtra: Internal Speakers
13:17:47.248 T:123145569652736 NOTICE: m_deviceType : AE_DEVTYPE_PCM
13:17:47.248 T:123145569652736 NOTICE: m_channels : FL, FR
13:17:47.248 T:123145569652736 NOTICE: m_sampleRates : 96000,88200,48000,44100
13:17:47.248 T:123145569652736 NOTICE: m_dataFormats : AE_FMT_S24LE3,AE_FMT_S24NE3,AE_FMT_S16LE,AE_FMT_S16NE,AE_FMT_FLOAT
13:17:47.248 T:123145569652736 NOTICE: m_streamTypes : No passthrough capabilities
13:17:47.248 T:123145569652736 NOTICE: Device 3
13:17:47.248 T:123145569652736 NOTICE: m_deviceName : HDMI-65
tream0
13:17:47.248 T:123145569652736 NOTICE: m_displayName : HDMI
13:17:47.248 T:123145569652736 NOTICE: m_displayNameExtra: SONY TV
13:17:47.248 T:123145569652736 NOTICE: m_deviceType : AE_DEVTYPE_HDMI
13:17:47.248 T:123145569652736 NOTICE: m_channels : FL, FR
13:17:47.248 T:123145569652736 NOTICE: m_sampleRates : 48000,44100,32000
13:17:47.248 T:123145569652736 NOTICE: m_dataFormats : AE_FMT_S24LE3,AE_FMT_S24NE3,AE_FMT_S16LE,AE_FMT_S16NE
13:17:47.248 T:123145569652736 NOTICE: m_streamTypes : STREAM_TYPE_AC3,STREAM_TYPE_DTS_512,STREAM_TYPE_DTS_1024,STREAM_TYPE_DTS_2048,STREAM_TYPE_DTSHD_CORE
Notice that SONY TV appears as "Device 3":
m_displayName : HDMI
m_displayNameExtra: SONY TV
Next I can look into some Kodi .plist files to see where the current display name appears:
Is it 'Device 1', m_deviceName, m_displayName or m_displayNameExtra?
-- Existing Configuration
I found the following excerpt in file:
/Library/Kodi/userdata/guisettings.xml
<settings>
<videoscreen>
<blankdisplays default="true">false</blankdisplays>
<fakefullscreen default="true">true</fakefullscreen>
<limitedrange default="true">false</limitedrange>
<monitor default="true">Default</monitor>
<preferedstereoscopicmode>2</preferedstereoscopicmode>
<resolution>30</resolution>
<screen>1</screen>
<screenmode>10072000480060.00000pstd</screenmode>
<stereoscopicmode default="true">0</stereoscopicmode>
<vsync default="true">2</vsync>
</videoscreen>
</settings>
Also discovered that the related user config file:
/Users/greg/Library/Application Support/Kodi/userdata/guisettings.xml
Contains the following:
<setting id="videoscreen.fakefullscreen" default="true">true</setting>
<setting id="videoscreen.monitor">SONY TV</setting>
-- SOLUTION: I modified Kodi configuration file, /Library/Kodi/userdata/guisettings.xml
Though it is not recommended to edit the default Kodi system config, I did.
I changed the default monitor from original "Default", which is using what is called m_displayName in the kodi.log file.
The kodi.log file refers to my SONY TV via m_displayName "HDMI"
I edited the user config file replacing "Default" with "HDMI":
/Library/Kodi/userdata/guisettings.xml
<settings>
<videoscreen>
<blankdisplays default="true">false</blankdisplays>
<fakefullscreen default="true">true</fakefullscreen>
<limitedrange default="true">false</limitedrange>
<monitor default="true">HDMI</monitor>
<preferedstereoscopicmode>2</preferedstereoscopicmode>
<resolution>30</resolution>
<screen>1</screen>
<screenmode>10072000480060.00000pstd</screenmode>
<stereoscopicmode default="true">0</stereoscopicmode>
<vsync default="true">2</vsync>
</videoscreen>
</settings>
PROBLEM SOLVED!