In order to input the backslash character "\" instead of "¥" on a Mac OS X system with Japanese keyboard settings, you should go to "System Preferences > Keyboard > Input Sources" then select the Japanese keyboard. Towards the bottom of the settings in the right pane change the setting for '"¥" key generates' to the value '\ (Backslash)'.