Can't save .las/.laz files on Mac

Feel free to ask any question here
Post Reply
kdjacob
Posts: 8
Joined: Thu Mar 06, 2025 3:28 pm
Location: Boston, USA

Can't save .las/.laz files on Mac

Post by kdjacob »

I really hope someone can help me here.

Here's the environment I'm running on a MacBook with Apple M1 silicon running Sequoia 15.3.1.

Attachment 0.jpg
Attachment 0.jpg (31.51 KiB) Viewed 10106 times

THE PROBLEM: I am unable to save ANY file from CC.

Here is the error message I get in the log window:

[16:29:11] An error occurred while saving '/Users/KenJacobMacbook/QGIS/LiDAR/temp test folder/USGS_LPC_CT_Statewide_C16_830905_nw_lasheight.laz': the third-party library in charge of saving/loading the file has failed to perform the operation

This error occurs if all I do is open a .laz file from the USGS website, do nothing to it, and then try to save it to a new file. And it happens to ALL other point clouds I've processed in CC (wonderfully, by the way -- very happy with what I can do in this program.)

I've attached the state of the save dialog box (I didn't change anything) in case that's helpful.

HELP PLEASE!!!

Sincerely,

Ken
Attachments
Screenshot 2025-03-08 at 4.28.13 PM.jpg
Screenshot 2025-03-08 at 4.28.13 PM.jpg (144.38 KiB) Viewed 10106 times
Screenshot 2025-03-08 at 4.27.52 PM.jpg
Screenshot 2025-03-08 at 4.27.52 PM.jpg (125.79 KiB) Viewed 10106 times
daniel
Site Admin
Posts: 7934
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Can't save .las/.laz files on Mac

Post by daniel »

I guess it's related to the github issue?

I'm also concerned that the 2.13 version is getting quite old. We should ask Paul Rascle to create a new binary with the latest 2.14.alpha version...
Daniel, CloudCompare admin
khzam
Posts: 10
Joined: Mon Mar 24, 2025 2:34 pm

Re: Can't save .las/.laz files on Mac

Post by khzam »

After upgrading to macos 15.4, all the buttons to open, save and save as are not working. Also cmd+s isn't working. There is no way to save data out of cloudcompare, I tried with these builds "CloudCompare_20250314_161011.dmg" and "CloudCompare_2.13.2__arm64.dmg"
khzam
Posts: 10
Joined: Mon Mar 24, 2025 2:34 pm

Re: Can't save .las/.laz files on Mac

Post by khzam »

I just built 2.14.alpha from source and the problem I still there. I can't save anything!!
daniel
Site Admin
Posts: 7934
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Can't save .las/.laz files on Mac

Post by daniel »

Isn't it different from the initial message? Because at that time the LAS saving dialog was visible...

Anyway, macOS is a different world. So maybe now that you have compiled the project there (good job by the way), you can debug things a little bit?
Daniel, CloudCompare admin
khzam
Posts: 10
Joined: Mon Mar 24, 2025 2:34 pm

Re: Can't save .las/.laz files on Mac

Post by khzam »

Sadly the build was a little broken, so I got rid off it. However, from the git issue a tip that worked for mac is to disable "Use native load / save dialog box" from display settigns.
andytrench
Posts: 6
Joined: Fri Apr 11, 2014 12:03 pm

Re: Can't save .las/.laz files on Mac

Post by andytrench »

I had a problem with 2.14 where i couldn't get the native open dialogue to work at all and i really needed it to work for my current workflow.
Checking the native dialogue box in settings did nothing.
So i have vibe-coded my way into a working version using the augment ai plugin for VS CODE... (I'm using augment over cursor these days and its kicking butt)

My setup:
M2 Macbook pro
Sequoia 15.1.1

I now have a working 2.14 with native file open dialogue so i'll share the readme to the fix here in case it can help someone else.


## Changes Made

1. **Added Bundle Identifier**: Updated `qCC/Mac/CMakeLists.txt` to include the `MACOSX_BUNDLE_GUI_IDENTIFIER` property with the value "org.cloudcompare.CloudCompare".

2. **Added macOS Native Dialog Option**: Added a new option `forceMacOSNativeDialogs` to the `ccOptions` class to specifically force native dialogs on macOS, overriding the general `useNativeDialogs` setting.

3. **Updated File Dialog Options**: Modified the `CCFileDialogOptions` function in `mainwindow.cpp` to use the `forceMacOSNativeDialogs` option on macOS.

## Manual Changes Required

If the automatic script didn't update all files correctly, you'll need to manually make the following changes:

### 1. Update qCC/Mac/CMakeLists.txt

Add the `MACOSX_BUNDLE_GUI_IDENTIFIER` property to the `set_target_properties` command:

```cmake
set_target_properties( ${PROJECT_NAME} PROPERTIES
INSTALL_RPATH "@executable_path/../Frameworks"
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/CloudCompare.plist
MACOSX_BUNDLE_ICON_FILE cc_icon.icns
MACOSX_BUNDLE_GUI_IDENTIFIER "org.cloudcompare.CloudCompare"
MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION}"
MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJECT_VERSION}"
MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_VERSION}" )
```

### 2. Update libs/CCAppCommon/include/ccOptions.h

Add the `forceMacOSNativeDialogs` option to the `ccOptions` class:

```cpp
//! Force native dialogs on macOS (overrides useNativeDialogs)
bool forceMacOSNativeDialogs;
```

### 3. Update libs/CCAppCommon/src/ccOptions.cpp

Initialize the `forceMacOSNativeDialogs` option in the `reset` method:

```cpp
void ccOptions::reset()
{
normalsDisplayedByDefault = false;
useNativeDialogs = true;
forceMacOSNativeDialogs = true;
confirmQuit = true;
}
```

Add the `forceMacOSNativeDialogs` option to the `fromPersistentSettings` method:

```cpp
void ccOptions::fromPersistentSettings()
{
QSettings settings;
settings.beginGroup(ccPS::Options());
{
normalsDisplayedByDefault = settings.value("normalsDisplayedByDefault", false).toBool();
useNativeDialogs = settings.value("useNativeDialogs", true).toBool();
forceMacOSNativeDialogs = settings.value("forceMacOSNativeDialogs", true).toBool();
confirmQuit = settings.value("confirmQuit", true).toBool();
}
settings.endGroup();
}
```

Add the `forceMacOSNativeDialogs` option to the `toPersistentSettings` method:

```cpp
void ccOptions::toPersistentSettings() const
{
QSettings settings;
settings.beginGroup(ccPS::Options());
{
settings.setValue("normalsDisplayedByDefault", normalsDisplayedByDefault);
settings.setValue("useNativeDialogs", useNativeDialogs);
settings.setValue("forceMacOSNativeDialogs", forceMacOSNativeDialogs);
settings.setValue("confirmQuit", confirmQuit);
}
settings.endGroup();
}
```

### 4. Update qCC/mainwindow.cpp

Replace the `CCFileDialogOptions` function with the following implementation:

```cpp
static QFileDialog::Options CCFileDialogOptions()
{
//dialog options
QFileDialog::Options dialogOptions = QFileDialog::Options();
dialogOptions |= QFileDialog::DontResolveSymlinks;

#ifdef Q_OS_MAC
// On macOS, always use native dialogs if the option is enabled
if (!ccOptions::Instance().useNativeDialogs && !ccOptions::Instance().forceMacOSNativeDialogs)
{
dialogOptions |= QFileDialog::DontUseNativeDialog;
}
#else
// On other platforms, follow the general setting
if (!ccOptions::Instance().useNativeDialogs)
{
dialogOptions |= QFileDialog::DontUseNativeDialog;
}
#endif

return dialogOptions;
}
```

## Building CloudCompare

After making these changes, build CloudCompare as usual:

```bash
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/Applications
make -j$(sysctl -n hw.ncpu)
make install
```

This will create a properly bundled CloudCompare application with the native file dialog fix.


----------
Additional context
----------

#!/bin/bash

# Apply macOS fixes to CloudCompare

# Define paths
CC_DIR="CloudCompare"
cd "$CC_DIR" || { echo "CloudCompare directory not found"; exit 1; }

# 1. Update the Mac CMakeLists.txt to include the bundle identifier
echo "Adding bundle identifier to qCC/Mac/CMakeLists.txt"
cat > qCC/Mac/CMakeLists.txt << 'EOF'
# Put together our App bundle on macOS
if( APPLE )
set_target_properties( ${PROJECT_NAME} PROPERTIES
INSTALL_RPATH "@executable_path/../Frameworks"
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/CloudCompare.plist
MACOSX_BUNDLE_ICON_FILE cc_icon.icns
MACOSX_BUNDLE_GUI_IDENTIFIER "org.cloudcompare.CloudCompare"
MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION}"
MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJECT_VERSION}"
MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_VERSION}" )

set( CLOUDCOMPARE_MAC_BASE_DIR ${CMAKE_INSTALL_PREFIX}/${CLOUDCOMPARE_DEST_FOLDER}/CloudCompare.app CACHE INTERNAL "CloudCompare bundle dir")
set( CLOUDCOMPARE_MAC_FRAMEWORK_DIR ${CLOUDCOMPARE_MAC_BASE_DIR}/Contents/Frameworks CACHE INTERNAL "CC framework dir" )
set( CLOUDCOMPARE_MAC_PLUGIN_DIR ${CLOUDCOMPARE_MAC_BASE_DIR}/Contents/PlugIns/ccPlugins CACHE INTERNAL "CC plugin dir" )

# install icons
install( FILES cc_icon.icns DESTINATION ${CLOUDCOMPARE_MAC_BASE_DIR}/Contents/Resources COMPONENT Runtime )
endif( APPLE )
EOF

# 2. Update the ccOptions.h file to add the macOS native dialog option
echo "Updating ccOptions.h to add macOS native dialog option"
if [ -f "libs/CCAppCommon/include/ccOptions.h" ]; then
# Add the new option to the existing file
sed -i.bak '/bool useNativeDialogs;/a\\n\t\/\/! Force native dialogs on macOS (overrides useNativeDialogs)\n\tbool forceMacOSNativeDialogs;' libs/CCAppCommon/include/ccOptions.h
else
echo "ccOptions.h not found"
exit 1
fi

# 3. Update the ccOptions.cpp file to implement the macOS native dialog option
echo "Updating ccOptions.cpp to implement macOS native dialog option"
if [ -f "libs/CCAppCommon/src/ccOptions.cpp" ]; then
# Add initialization for the new option
sed -i.bak 's/useNativeDialogs = true;/useNativeDialogs = true;\n\tforceMacOSNativeDialogs = true;/' libs/CCAppCommon/src/ccOptions.cpp

# Add the new option to the settings loading
sed -i.bak '/useNativeDialogs = settings.value("useNativeDialogs", true).toBool();/a\\t\tforceMacOSNativeDialogs = settings.value("forceMacOSNativeDialogs", true).toBool();' libs/CCAppCommon/src/ccOptions.cpp

# Add the new option to the settings saving
sed -i.bak '/settings.setValue("useNativeDialogs", useNativeDialogs);/a\\t\tsettings.setValue("forceMacOSNativeDialogs", forceMacOSNativeDialogs);' libs/CCAppCommon/src/ccOptions.cpp
else
echo "ccOptions.cpp not found"
exit 1
fi

# 4. Update the CCFileDialogOptions function in mainwindow.cpp
echo "Updating CCFileDialogOptions function in mainwindow.cpp"
if [ -f "qCC/mainwindow.cpp" ]; then
# Create a temporary file with the new function
cat > /tmp/CCFileDialogOptions.txt << 'EOF'
static QFileDialog::Options CCFileDialogOptions()
{
//dialog options
QFileDialog::Options dialogOptions = QFileDialog::Options();
dialogOptions |= QFileDialog::DontResolveSymlinks;

#ifdef Q_OS_MAC
// On macOS, always use native dialogs if the option is enabled
if (!ccOptions::Instance().useNativeDialogs && !ccOptions::Instance().forceMacOSNativeDialogs)
{
dialogOptions |= QFileDialog::DontUseNativeDialog;
}
#else
// On other platforms, follow the general setting
if (!ccOptions::Instance().useNativeDialogs)
{
dialogOptions |= QFileDialog::DontUseNativeDialog;
}
#endif

return dialogOptions;
}
EOF

# Find the function in the file
LINE_START=$(grep -n "static QFileDialog::Options CCFileDialogOptions()" qCC/mainwindow.cpp | cut -d':' -f1)
if [ -z "$LINE_START" ]; then
echo "Could not find CCFileDialogOptions function in mainwindow.cpp"
exit 1
fi

# Find the end of the function (the closing brace)
LINE_END=$((LINE_START + 10)) # Assuming the function is about 10 lines long
while [ $LINE_END -lt $(wc -l < qCC/mainwindow.cpp) ]; do
if grep -q "^}" <(sed -n "${LINE_END}p" qCC/mainwindow.cpp); then
break
fi
LINE_END=$((LINE_END + 1))
done

# Replace the function with our new implementation
sed -i.bak "${LINE_START},${LINE_END}c\\$(cat /tmp/CCFileDialogOptions.txt)" qCC/mainwindow.cpp
else
echo "mainwindow.cpp not found"
exit 1
fi

echo "macOS fixes applied successfully!"
echo ""
echo "To build CloudCompare with these changes, you need to:"
echo "1. Install Qt5 on your system"
echo "2. Configure the build with CMake, pointing to your Qt5 installation:"
echo " mkdir -p build"
echo " cd build"
echo " cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/Applications -DQt5_DIR=/path/to/Qt5/lib/cmake/Qt5"
echo "3. Build and install CloudCompare:"
echo " make -j$(sysctl -n hw.ncpu)"
echo " make install"


--------
Additional Fixes Explanation
--------

# CloudCompare macOS Build Fixes

This document outlines the fixes required to build CloudCompare on macOS systems.

## Common Build Issues and Solutions

### 1. Missing `forceMacOSNativeDialogs` Variable

**Issue**: The `forceMacOSNativeDialogs` variable is used in `ccOptions.cpp` but not declared in `ccOptions.h`.

**Fix**: Add the variable declaration to `ccOptions.h`:

```cpp
// In CloudCompare/libs/CCAppCommon/include/ccOptions.h
// Add after the useNativeDialogs declaration:

//! Force native dialogs on macOS (overrides useNativeDialogs)
bool forceMacOSNativeDialogs;
```

### 2. Indentation Issues in ccOptions.cpp

**Issue**: The `ccOptions.cpp` file has incorrect indentation, which can cause build errors.

**Fix**: Ensure proper indentation throughout the file. For example:

```cpp
// Before:
void ccOptions::reset()
{
normalsDisplayedByDefault = false;
useNativeDialogs = true;
forceMacOSNativeDialogs = true;
confirmQuit = true;
}

// After:
void ccOptions::reset()
{
normalsDisplayedByDefault = false;
useNativeDialogs = true;
forceMacOSNativeDialogs = true;
confirmQuit = true;
}
```

### 3. Preprocessor Directive Errors in mainwindow.cpp

**Issue**: The `mainwindow.cpp` file contains duplicate preprocessor directives (`#else` and `#endif` without matching `#if` statements).

**Fix**: Remove the duplicate directives and ensure proper pairing of preprocessor statements:

```cpp
// Correct structure:
#ifdef Q_OS_MAC
// On macOS, always use native dialogs if the option is enabled
if (!ccOptions::Instance().useNativeDialogs && !ccOptions::Instance().forceMacOSNativeDialogs)
{
dialogOptions |= QFileDialog::DontUseNativeDialog;
}
#else
// On other platforms, follow the general setting
if (!ccOptions::Instance().useNativeDialogs)
{
dialogOptions |= QFileDialog::DontUseNativeDialog;
}
#endif

return dialogOptions;
}
```

## Building CloudCompare on macOS

After applying the fixes above, follow these steps to build CloudCompare:

1. Create a build directory:
```bash
mkdir build && cd build
```

2. Configure with CMake:
```bash
cmake -DCMAKE_PREFIX_PATH=/path/to/qt ..
```

Note: If using Homebrew-installed Qt, the path might be `/usr/local/opt/qt@5` or similar.

3. Build the project:
```bash
make -j$(sysctl -n hw.ncpu)
```

4. Run CloudCompare:
```bash
open qCC/CloudCompare.app
```

## Additional macOS-Specific Notes

1. **Qt Version**: CloudCompare 2.13+ requires 5.12 <= Qt < 6.0.

2. **Native Dialogs**: The `forceMacOSNativeDialogs` option ensures that native file dialogs are used on macOS, which provides a better user experience.

3. **Development Paths**: If you are compiling and running locally, add `-DCC_MAC_DEV_PATHS` to the `CMAKE_CXX_FLAGS` in the `CMAKE` group. This will look for plugins in your build directory rather than the application bundle.

4. **Portable Build**: For a portable (relocatable) build, consider using the `pixi` build system as mentioned in the main BUILD.md file.

## Troubleshooting

If you encounter issues with running the built application:

1. **Library Path Issues**: Ensure that all required libraries are properly linked and can be found at runtime.

2. **Plugin Loading**: Check that plugins are correctly built and placed in the expected directories.

3. **Qt Framework**: Verify that the Qt frameworks are correctly bundled with the application or accessible in the system.

4. **Code Signing**: For distribution, you may need to properly code sign the application.
daniel
Site Admin
Posts: 7934
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Can't save .las/.laz files on Mac

Post by daniel »

Thanks, I've linked your message on the git issue discussion: https://github.com/CloudCompare/CloudCo ... ssues/2152
Daniel, CloudCompare admin
Post Reply