{"id":1659,"date":"2016-06-27T17:07:21","date_gmt":"2016-06-27T08:07:21","guid":{"rendered":"https:\/\/learningbox.co.jp\/?p=1659"},"modified":"2018-09-17T22:22:40","modified_gmt":"2018-09-17T13:22:40","slug":"mac%e3%81%a7date%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89%e3%81%8c%e9%81%95%e3%81%86%e4%bb%b6%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6","status":"publish","type":"post","link":"https:\/\/learningbox.co.jp\/en\/2016\/06\/27\/mac%e3%81%a7date%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89%e3%81%8c%e9%81%95%e3%81%86%e4%bb%b6%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6\/","title":{"rendered":"About the date command being different on Mac"},"content":{"rendered":"<p>Mac seems to be based on BSD Unix, and there is some difference from GUN Linux commands.<br \/>\nSo, I'm talking about putting GNU commands into Mac.<br \/>\nTo be honest, I've only noticed date and xargs so far, but...<\/p>\n<p>Just to put the difference in perspective...<\/p>\n<p>BSD-style date command<\/p>\n<blockquote><p>\n# 1 day ago<br \/>\ndate -v-1d\n<\/p><\/blockquote>\n<p>The GNU-style date command<\/p>\n<blockquote><p>\n# 1 day ago<br \/>\ndate -d '-1 day'\n<\/p><\/blockquote>\n<p>So, to install the GNU-style commands on your Mac, you can use<\/p>\n<blockquote><p>\nbrew install coreutils\n<\/p><\/blockquote>\n<p>You can do this by running<br \/>\nI thought this should change the date command, but the installed command has a \"g\" prefix, so you need to define an alias with an alias (like gdate)<br \/>\nSo, define an alias in the .bashrc file.<\/p>\n<blockquote><p>\n# In my environment<br \/>\nalias date='\/usr\/local\/bin\/gdate'\n<\/p><\/blockquote>\n<p>Now you can use the GNU-style date command.<\/p>","protected":false},"excerpt":{"rendered":"Mac\u306fBSD Unix\u30d9\u30fc\u30b9\u3089\u3057\u304f\u3001GUN Linux\u306e\u30b3\u30de\u30f3\u30c9\u3068\u82e5\u5e72\u5dee\u4f4d\u304c\u3042\u308b\u3002 \u306a\u306e\u3067 GNU\u7cfb\u306e\u30b3\u30de\u30f3 [&hellip;]","protected":false},"author":1,"featured_media":2483,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","_wpcom_ai_launchpad_first_post":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[6],"tags":[],"class_list":["post-1659","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog"],"acf":[],"jetpack_shortlink":"https:\/\/wp.me\/pgMrZ4-qL","jetpack_featured_media_url":"https:\/\/learningbox.co.jp\/wp-content\/uploads\/2018\/09\/mac_1537190546.jpg","_links":{"self":[{"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/posts\/1659","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/comments?post=1659"}],"version-history":[{"count":1,"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/posts\/1659\/revisions"}],"predecessor-version":[{"id":2484,"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/posts\/1659\/revisions\/2484"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/media\/2483"}],"wp:attachment":[{"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/media?parent=1659"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/categories?post=1659"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/tags?post=1659"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}