diff --git a/include/class.user.php b/include/class.user.php
index 3ee809b845863cb388440b37754e4baab873abb7..5e2ee73b070531d0523359abf1a6214ae52d9c44 100644
--- a/include/class.user.php
+++ b/include/class.user.php
@@ -456,6 +456,8 @@ class User extends UserModel {
 
     function importFromPost($stuff, $extra=array()) {
         if (is_array($stuff) && !$stuff['error']) {
+            // Properly detect Macintosh style line endings
+            ini_set('auto_detect_line_endings', true);
             $stream = fopen($stuff['tmp_name'], 'r');
         }
         elseif ($stuff) {
diff --git a/setup/cli/modules/user.php b/setup/cli/modules/user.php
index aef84a2123e5ecea6b4d61841516b225d0fc2a60..2d6d146a9950a95fda1bd4ad07c4b7a836148368 100644
--- a/setup/cli/modules/user.php
+++ b/setup/cli/modules/user.php
@@ -31,6 +31,9 @@ class UserManager extends Module {
 
         switch ($args['action']) {
             case 'import':
+                // Properly detect Macintosh style line endings
+                ini_set('auto_detect_line_endings', true);
+
                 if (!$options['file'])
                     $this->fail('CSV file to import users from is required!');
                 elseif (!($this->stream = fopen($options['file'], 'rb')))